home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Belgian Amiga Club - ADF Collection
/
BS1 part 63.zip
/
BS1 part 63
/
Video Tracker dev. kit d1.adf
/
Source
/
Vector.s
< prev
next >
Wrap
Text File
|
1993-08-09
|
72KB
|
3,667 lines
rout ;when this is off, the routine-file will be
;assembled, on=testing
;debug ;when this is on, colors in the background will
;show how much time the routine needs.
routinemode equ 15 ;the routinemode !
; the first part of the source handles the things that are necessary to
; show the picture/copper and playing of the routine.
; the part between the "***" lines is the routine-source.
; at the bottom of the file, there are the necessary incbin-files who
; are needed to test the routine.
; these are saved with "save effect" in videotracker. they are raw
; data files which can be fonts,pictures,landscapes,vectorobjects
; etcetra.
; the incbin-files are put in the "variables" table, in the routine-
; player-handler
; the place where it's done can be found by searching for "!!!"
opt a+ ;devpac 3 optimize
opt o+
ifd rout
;videotracker routine-test
incdir "videotracker:include/"
include "exec/types.i"
include "graphics/gfxbase.i"
include "lvo/graphics_lib.i"
incdir 'videotracker:effect/'
vew_wid equ 44
vew_hgt equ 290
win_hgt equ 117
win_str equ $1a
SECTION 1,CODE_C
tus
lea var,a0 ;communication-table
move.l #rottube,var_vec1(a0) ;incbinfile !!!
move.l ($4).w,a6
sub.l a1,a1
jsr -$126(a6) ;findtask
move.l d0,curtsk
move.l d0,a0
move.l $b8(a0),tskpri
lea dosnam,a1 ;doslib openen
moveq.l #0,d0
move.l (4).w,a6
jsr -408(a6) ;openlib
move.l d0,doslib
bsr.s label5 ;videotracker opstarten
move.l curtsk,a0
move.l tskpri,$b8(a0)
move.l ($4).w,a6
jsr -$84(a6) ;forbid
move.l doslib,a1
move.l (4).w,a6
jsr -414(a6) ;closelib
moveq.l #0,d0
rts
label5
move.l (4).w,a6 ;workbench gedoe
move.b 530(a6),ntscmode ;50/60 hertz halen
cmp.b #50,ntscmode ;ntsc ?
beq.s str.ntsc
move.l #vew_hgt-56,hogscr ;set NTSC screen hight
str.ntsc
move.l (4).w,a6 ;68030 cache off
jsr -120(a6)
btst.b #1,297(a6)
beq.s str.nfc
lea.l str.ft,a5
jsr -30(a6)
str.nfc
jsr -126(a6)
bra.s str.fc
str.ft
dc.w $4e7a,2
bclr #0,d0
bset #13,d0
dc.w $4e7b,2
rte
str.fc
lea cprjmp,a2 ;copjmp zetten !
move.l #cprbck-8,d0
move.w d0,6(a2)
swap d0
move.w d0,2(a2)
lea cprbck-8,a2 ;copstr zetten !
move.l #cpr,d0
move.w d0,6(a2)
swap d0
move.w d0,2(a2)
bsr cprsprrem ;sprites legen
lea gfxnam,a1 ;graphics lib openen
move.l (4).w,a6
jsr -408(a6) ;openlib
move.l d0,a6
move.l d0,gfxlib
move.l 38(a6),oldcprlist
bset #1,$bfe001
bsr copbuf ;copper vullen
bsr sysoff
gadrun
btst #6,($bfe001).l
bne gadrun
scrend
scrend.play
bsr syson
move.l gfxlib,a1
move.l (4).w,a6
jsr -414(a6) ;closelib
scrend.qb
moveq.l #0,d0
rts
;vertical blank interrupt, no blits.
;handles counters,interlace,sprite
;level 3
intvb
bra.s intvb.cnt
dc.l 'VIDU'
dc.l 'LOOP'
intvb.cnt
movem.l d0-d7/a0-a6,-(sp)
lea ($dff000).l,a6
move.w $01e(a6),d0
btst #5,d0 ;vblank ?
bne.s intvb.vb
bra.s intcop.end
intvb.vb
bsr grap
bsr palctr ;palette zetten
bsr.s copbuf ;copper vullen
intvb.end
move.w #$0020,$09c(a6) ;vb bit wissen
movem.l (sp)+,d0-d7/a0-a6 ;multitask uit, shit !
rte
intcop.end
movem.l (sp)+,d0-d7/a0-a6
move.l intvbold,-(sp)
rts
;transmission buffer empty routine, BLIT !
;handles routines,animations
inttbe ;tbe interrupt
movem.l d0-d7/a0-a6,-(sp)
lea ($dff000).l,a6
move.w $01e(a6),d0
btst #0,d0 ;no tbe ?
beq.s intdskblk
btst #6,($bfe001).l ;muis ingedrukt ?
beq.s inttbe.cop
btst #2,($dff016).l
beq.s inttbe.cop
ifd debug
move.w #$700,$dff180
endc
bsr rotply ;routineplayer BLIT !
bsr.s copbuf ;copper vullen
ifd debug
move.w #$070,$dff180
endc
inttbe.cop
inttbe.end
move.w #$0001,$09c(a6)
movem.l (sp)+,d0-d7/a0-a6
rte
intdskblk
move.w #$0001,$09c(a6) ;be sure for no tbe handling
movem.l (sp)+,d0-d7/a0-a6
move.l inttbeold,-(sp)
rts
;moves the copperbuffer to the copperlist
;sort of double buffering
copbuf
movem.l d0-d7/a0-a6,-(sp)
lea ($dff000).l,a6
copbuf.novb ;copperchange overslaan
moveq.l #0,d0
move.b $005(a6),d0
lsl.w #8,d0
moveq.l #0,d1
move.b $006(a6),d1
add.w d1,d0
cmp.w #$4,d0
blt copbuf.novb
cmp.b #50,ntscmode
beq.s copbuf.pal
cmp.w #$133-56-8,d0 ;ntsc grens
bge copbuf.novb
bra.s copbuf.cont
copbuf.pal
cmp.w #$133-8,d0 ;pal grens
bge copbuf.novb
copbuf.cont
lea gra.s,a0 ;buffer copieren
lea cprbuf,a1
move.w 00*4+2(a0),00*4+2(a1)
move.w 01*4+2(a0),01*4+2(a1)
move.w 02*4+2(a0),02*4+2(a1)
move.w 03*4+2(a0),03*4+2(a1)
move.w 04*4+2(a0),04*4+2(a1)
move.w 05*4+2(a0),05*4+2(a1)
move.w 06*4+2(a0),06*4+2(a1)
move.w 07*4+2(a0),07*4+2(a1)
move.w 08*4+2(a0),08*4+2(a1)
move.w 09*4+2(a0),09*4+2(a1)
move.w 10*4+2(a0),10*4+2(a1)
move.w 11*4+2(a0),11*4+2(a1)
move.w 12*4+2(a0),12*4+2(a1)
move.w 13*4+2(a0),13*4+2(a1)
move.w 14*4+2(a0),14*4+2(a1)
move.w 15*4+2(a0),15*4+2(a1)
move.w 16*4+2(a0),16*4+2(a1)
move.w 17*4+2(a0),17*4+2(a1)
move.w 18*4+2(a0),18*4+2(a1)
move.w 19*4+2(a0),19*4+2(a1)
move.w 20*4+2(a0),20*4+2(a1)
move.w 21*4+2(a0),21*4+2(a1)
move.w 22*4+2(a0),22*4+2(a1)
move.w 23*4+2(a0),23*4+2(a1)
move.w 24*4+2(a0),24*4+2(a1)
move.w 25*4+2(a0),25*4+2(a1)
move.w 26*4+2(a0),26*4+2(a1)
move.w 27*4+2(a0),27*4+2(a1)
move.w 28*4+2(a0),28*4+2(a1)
move.w 29*4+2(a0),29*4+2(a1)
move.w 30*4+2(a0),30*4+2(a1)
move.w 31*4+2(a0),31*4+2(a1)
move.w 32*4+2(a0),32*4+2(a1)
move.w 33*4+2(a0),33*4+2(a1)
move.w 34*4+2(a0),34*4+2(a1)
move.w 35*4+2(a0),35*4+2(a1)
move.w 36*4+2(a0),36*4+2(a1)
move.w 37*4+2(a0),37*4+2(a1)
move.w 38*4+2(a0),38*4+2(a1)
move.w 39*4+2(a0),39*4+2(a1)
move.w 40*4+2(a0),40*4+2(a1)
move.w 41*4+2(a0),41*4+2(a1)
move.w 42*4+2(a0),42*4+2(a1)
move.w 43*4+2(a0),43*4+2(a1)
move.w 44*4+2(a0),44*4+2(a1)
move.w 45*4+2(a0),45*4+2(a1)
move.w 46*4+2(a0),46*4+2(a1)
move.w 47*4+2(a0),47*4+2(a1)
move.w 48*4+2(a0),48*4+2(a1)
move.w 49*4+2(a0),49*4+2(a1)
move.w 50*4+2(a0),50*4+2(a1)
move.w 51*4+2(a0),51*4+2(a1)
move.w 52*4+2(a0),52*4+2(a1)
move.w 53*4+2(a0),53*4+2(a1)
move.w 54*4+2(a0),54*4+2(a1)
copbuf.end
movem.l (sp)+,d0-d7/a0-a6
rts
;goes back to the workbench
syson
movem.l d0-d7/a0-a6,-(sp)
move.w #$0001,$dff09a ;tbeint uit
move.l intvbold,($6c).w
move.l inttbeold,($64).w
move.l 4,a6
jsr -138(a6) ;permit
move.l gfxlib,a6
jsr -462(a6) ;disownblitter
move.l wbview,a1
move.l gfxlib,a6
jsr _LVOLoadView(a6) ; Fix view
jsr _LVOWaitTOF(a6)
jsr _LVOWaitTOF(a6) ; wait for LoadView()
syson.ras
cmp.b #$c0,$dff006 ;prevent copperjump
bne syson.ras
move.l gfxlib,a6
move.l gb_copinit(a6),$dff080 ; Kick it into life
movem.l (sp)+,d0-d7/a0-a6
rts
;goes back to the gadgetscreen
sysoff
movem.l d0-d7/a0-a6,-(sp)
move.l gfxlib,a6
move.l gb_ActiView(a6),wbview ;current view
sub.l a1,a1 ; clear a1
jsr _LVOLoadView(a6) ; Flush View to nothing
jsr _LVOWaitTOF(a6) ; Wait once
jsr _LVOWaitTOF(a6) ; Wait again.
move.l gfxlib,a6
jsr -456(a6) ;ownblitter
move.l 4,a6
jsr -132(a6) ;forbid
move.l ($6c).w,intvbold
move.l #intvb,($6c).w
move.l ($64).w,inttbeold
move.l #inttbe,($64).w
move.w #$8001,$dff09a ;tbeint aan
bsr gracpr ;reset copper
bsr copbuf ;copy copper
move.l #cpr,$dff080
movem.l (sp)+,d0-d7/a0-a6
rts
cprsprrem
movem.l d0-d7/a0-a6,-(sp)
lea cprspr,a0
move.l #sprdat,d0
move.w #7,d1
cprsprrem.a
move.w d0,3*2(a0)
swap d0
move.w d0,1*2(a0)
swap d0
add.l #8,a0
dbra d1,cprsprrem.a
movem.l (sp)+,d0-d7/a0-a6
rts
varset ;variablen neerzetten
movem.l d0-d7/a0-a6,-(sp)
move.l #var,a0
move.l #cprbck,var_cprbck(a0)
move.l gfxlib,var__GfxBase(a0)
move.b ntscmode,var_ntsc(a0)
move.l curpic1,var_pic1(a0) ;variabel
move.l curpic2,var_pic2(a0) ;variabel
move.w anispd1,var_anispd1(a0)
move.w anitel1,var_anitel1(a0)
movem.l (sp)+,d0-d7/a0-a6
rts
;this routine handles all videotracker-routines
rotply
movem.l d0-d7/a0-a6,-(sp)
moveq.l #0,d0
lea currot1,a2 ;routine 1
move.w rotinf1,d0 ;routine info
bsr.s rotplyr
rotply.end
movem.l (sp)+,d0-d7/a0-a6
rts
;this routine handles 1 routine, BLIT !
rotplyr
movem.l d0-d7/a1-a6,-(sp)
move.l #rot,(a2) ;routinestart address
move.b #50,ntscmode ;ntsc/pal hz
clr.l curpic2 ;background picture
move.w #1,anispd1 ;animationspeed
clr.w anitel1 ;animation position
lea var,a0 ;communication-table
move.l #routinemode,d0 ;routinemode !!!
sub.l a0,a0 ;picture info legen
tst.l (a2) ;is er een routine ?
beq rotplyr.end ;interlace handling
move.l intdel,d2 ;delay
move.l inttel,d1 ;teller
cmp.w d2,d1
blt rotplyr.end
clr.l inttel
bsr varset ;variabelen updaten
move.l (a2),a1 ;routine halen
move.l #var,a0 ;variablen tabel
movem.l d3-d7/a1-a6,-(sp)
moveq.l #0,d1 ;vars wissen
moveq.l #0,d2
moveq.l #0,d3
moveq.l #0,d4
moveq.l #0,d5
moveq.l #0,d6
moveq.l #0,d7
sub.l a2,a2
sub.l a3,a3
sub.l a4,a4
sub.l a5,a5
jsr 4(a1) ;routine afwerken
movem.l (sp)+,d3-d7/a1-a6
;Routine:
;
;Input:
;a0=variabelentabel
;d0=routinemode
;
;Output:
;a0=picture
;d1=copperlist
;d2=interruptdelay (NOT used till now)
move.w #$0020,$dff09a ;vb off !
move.l d2,intdel ;delay
lea cprjmp,a3
move.l #cprbck-8,d0
cmp.l (a2),a1 ;routine ondertussen gewipt ?
bne.s rotplyr.nocop
tst.l d1 ;copperlist ?
beq.s rotplyr.nocop
move.l d1,d0
rotplyr.nocop
move.w d0,6(a3)
swap d0
move.w d0,2(a3)
cmp.l #0,a0 ;picture ?
beq.s rotplyr.endvb
move.l a0,curpic1 ;current picture (cycle)
move.l a0,curpal1 ;current palette
tst.b rotdpl ;plane is geleverd
beq.s rotplyr.set
clr.b rotdpl
clr.l cycdel1 ;cycle info wissen
clr.l 4+cycdel1
clr.l curfrm1 ;curfrm1, altijd planes zetten
rotplyr.set
clr.b dplctr
bsr.s grap
bsr grac ;colorset
rotplyr.endvb
move.w #$8020,$dff09a
rotplyr.end
movem.l (sp)+,d0-d7/a1-a6
rts
;removes possible routine-coppers
gracpr
movem.l d0-d7/a0-a6,-(sp)
lea cprjmp,a3
move.l #cprbck-8,d0 ;copperlist resetten
move.w d0,6(a3)
swap d0
move.w d0,2(a3)
movem.l (sp)+,d0-d7/a0-a6
rts
;picture-to-copper routine, communicates with the
;anim-player
grap ;d7=anim
movem.l d0-d7/a0-a6,-(sp)
clr.l d7
tst.l curpic1 ;current picture ?
beq grap.end
move.l curpic1,a2 ;normal pic halen
lea gracprscr,a1 ;window neerzetten
move.l hogscr,d1
move.w pic_hgt(a2),d3 ;pic hoogte
move.w pic_vew(a2),d5
btst #2,d5 ;interlace ?
beq.s grap.nohi4
lsr.w #1,d3 ;/2
grap.nohi4
cmp.w d3,d1
bge.s grap.hog
move.w d1,d3
grap.hog
sub.w d3,d1
lsr.w #1,d1
add.w #win_str,d1
move.w d1,d2
add.w d3,d2
move.b d1,2(a1) ;y start
move.b d2,6(a1) ;y end
move.w pic_wid(a2),d4 ;pic breedte in bytes
lsl.l #3,d4
move.l #vew_wid*8,d0
move.l #0,d1
move.l #$71,d6
move.w pic_vew(a2),d5
btst #15,d5 ;hires ?
beq.s grap.nohi2
move.l #(vew_wid-4)*8*2,d0
move.l #1,d1
move.l #$81,d6
cmp.w #80,pic_wid(a2) ;overscan ?
ble.s grap.nohi2
move.l #(vew_wid)*8*2,d0
move.l #$61,d6
grap.nohi2
btst #6,d5 ;super hires ?
beq.s grap.noshi2
move.l #(vew_wid-4)*8*4,d0
move.l #2,d1
move.l #$81,d6
cmp.w #80*2,pic_wid(a2) ;overscan ?
ble.s grap.noshi2
move.l #(vew_wid)*8*4,d0
move.l #$61,d6
grap.noshi2
clr.w d5
cmp.w d0,d4 ;breeder dan scherm ?
ble.s grap.c
move.w d4,d5
move.w d0,d4
sub.w d0,d5 ;modulo
lsr.w #3,d5 ;/8
grap.c
lsr.w d1,d0
lsr.w d1,d4
move.w d0,d2
sub.w d4,d2
lsr.w #1,d2 ;/2
add.w d6,d2
move.b d2,3(a1) ;x start
move.w d2,d3 ;d3 bewaren !
add.w d4,d2 ;d4 bewaren !
move.b d2,7(a1) ;x end
move.w pic_vew(a2),d6
btst #15,d6 ;hires ?
beq.s grap.nohi5
add.l d4,d4 ;*2
grap.nohi5
btst #6,d6 ;super hires ?
beq.s grap.noshi5
add.l d4,d4 ;*4
grap.noshi5
move.l d7,-(sp)
move.w pic_vew(a2),d6
move.l #17,d0
move.l #1,d1
move.l #3,d7
btst #15,d6 ;hires ?
beq.s grap.nohi3
move.l #9,d0
move.l #2,d1
move.l #2,d7
grap.nohi3
btst #6,d6 ;super hires ?
beq.s grap.noshi3
move.l #9,d0
move.l #2,d1
move.l #1,d7
grap.noshi3
sub.w d0,d3
lsr.w #1,d3
move.w d3,10(a1) ;ddfstrt
move.w d4,d2 ;pic breedte in pixels
lsr.w #4,d2 ;/16
sub.w d1,d2 ;-1
lsl.w d7,d2 ;*8
add.w d2,d3
move.w d3,14(a1) ;ddfstop
move.l (sp)+,d7
lea pic_raw(a2),a0
moveq.l #0,d2
move.w pic_dpt(a2),d2
sub.l #1,d2
muls pic_wid(a2),d2
add.w d2,d5
move.w pic_vew(a2),d2 ;viewmode add
btst #2,d2
beq.s grap.nolace4
moveq.l #0,d2
move.w pic_dpt(a2),d2
muls pic_wid(a2),d2
add.w d2,d5 ;interlace gedoe
grap.nolace4
lea gracprbpl,a4 ;iffpln neerzetten
lea gracprpln,a0 ;iffpln neerzetten
moveq.l #0,d2
move.w pic_dpt(a2),d2 ;plnnummer 1 halen
move.l #8,d6 ;copper step !
tst.l curpic2 ;2de picture ?
bne.s grap.pic2
grap.nopic2
move.w d5,34(a1) ;modulo oneven zetten
bra grap.nodpl
grap.pic2
move.l curpic2,a3 ;oneven plane
move.l currot2,a5 ;oneven plane
clr.l curpic2 ;mischien niet goed
clr.l curpal2 ;mischien niet goed
clr.l currot2 ;mischien niet goed
cmp.l curpic1,a3 ;picture hetzelfde ?
beq grap.nopic2
cmp.l #0,currot1 ;routine ?
beq.s grap.norot
cmp.l currot1,a5 ;routine hetzelfde ?
beq grap.nopic2
grap.norot
cmp.b #3,d2 ;> 8 kleuren ?
bgt grap.nopic2
move.w pic_dpt(a3),d3 ;plnnummer 2 halen
cmp.b d2,d3 ;gelijke plnummers ?
bne grap.nopic2
move.w pic_vew(a2),d1
cmp.w pic_vew(a3),d1 ;view gelijk ?
bne grap.nopic2
move.w pic_vew(a2),d1 ;groter dan view test
btst #6,d1 ;super hires ?
beq.s grap.nohi2a
move.l #vew_wid*4,d1
bra.s grap.nohi2b
grap.nohi2a
btst #15,d1 ;hires ?
beq.s grap.noshi2a
move.l #vew_wid*2,d1
bra.s grap.nohi2b
grap.noshi2a
move.l #vew_wid,d1
grap.nohi2b
cmp.w pic_wid(a2),d1 ;breder dan view ?
bgt.s grap.small
cmp.w pic_wid(a3),d1 ;breder dan view ?
bgt.s grap.small
move.w pic_vew(a2),d1
btst #2,d1
beq.s grap.nolace8a
move.l hogscr,d1
add.l d1,d1
bra.s grap.nolace8b
grap.nolace8a
move.l hogscr,d1
grap.nolace8b
cmp.w pic_hgt(a2),d1 ;hoger dan view ?
bgt.s grap.small
cmp.w pic_hgt(a3),d1 ;hoger dan view ?
bgt.s grap.small
bra.s grap.big
grap.small
move.w pic_hgt(a2),d1 ;wid+hgt<vew
cmp.w pic_hgt(a3),d1 ;hoogte gelijk ?
bne grap.nopic2
move.w pic_wid(a2),d1
cmp.w pic_wid(a3),d1 ;breedte gelijk ?
bne grap.nopic2
grap.big
move.l a3,curpic2
move.l a3,curpal2
move.l a5,currot2
tst.b dplctr ;double playfield al gezet ?
beq.s grap.nocop
move.w 30(a1),34(a1) ;modulo copieren
move.w 2(a4),d1 ;bplcon0
btst #10,d1 ;al double playfield ?
beq.s grap.ta
move.w 2(a0),10(a0) ;plane 0>1 copieren
move.w 6(a0),14(a0)
move.w 18(a0),26(a0) ;plane 2>3 copieren
move.w 22(a0),30(a0)
move.w 34(a0),42(a0) ;plane 4>5 copieren
move.w 38(a0),46(a0)
bra.s grap.tb
grap.ta
move.w 18(a0),42(a0) ;plane 2>5 copieren
move.w 22(a0),46(a0)
move.w 10(a0),26(a0) ;plane 1>3 copieren
move.w 14(a0),30(a0)
move.w 2(a0),10(a0) ;plane 0>1 copieren
move.w 6(a0),14(a0)
grap.tb
move.l #palette,a3 ;palette copieren
move.w #8-1,d1
grap.pal
move.w (a3)+,14(a3)
dbra d1,grap.pal
grap.nocop
add.w d3,d2
lsl.w #8,d2
lsl.w #4,d2
or.w #$400,d2
move.w d2,2(a4) ;bplcon0
movem.l d0-d7/a0-a6,-(sp)
move.l curpic,a2 ;animpic ?
move.l curfrm,d7
cmp.l #0,a2
bne.s grap.noanipic
move.l curpic2,a2 ;normal pic ?
move.l curfrm2,d7
cmp.l #0,a2
beq.s grap.nodplpic
grap.noanipic
add.l d6,a0
add.w d6,d6
bsr.s grappln ;a2,d6,d7,d0
grap.nodplpic
movem.l (sp)+,d0-d7/a0-a6
add.w d6,d6
bra.s grap.nodpla
grap.nodpl ;geen double playfield
lsl.w #8,d2
lsl.w #4,d2
move.w d2,2(a4) ;bplcon0
grap.nodpla
move.w d5,30(a1) ;modulo even
moveq.l #0,d3
add.w pic_vew(a2),d3 ;viewmode add
moveq.l #0,d2
move.w 2(a4),d2
or.l d3,d2
or.l #$300,d2 ;genlock info
move.w d2,2(a4)
bsr.s grappln ;a2,d6,d7,d0
grap.end
movem.l (sp)+,d0-d7/a0-a6
rts
;sets on of the 2 possible pictures to the copper
;handles interlace
;d7=framenummer
;d6=copperliststap
;d0=raw planes positie
;a2=current picture
grappln ;planes invullen
movem.l d0-d7/a0-a6,-(sp)
lea pic_raw(a2),a1
move.l a1,d0 ;raw planes
moveq.l #0,d2 ;x*y
move.w pic_wid(a2),d2
lsr.l #1,d2 ;/2
moveq.l #0,d3
move.w pic_hgt(a2),d3
muls d3,d2
move.l d2,d4
add.l d2,d2
move.w pic_dpt(a2),d3
muls d3,d4 ;hele picture size
muls d7,d4 ;frame*size d7 !
add.l d4,d4
add.l d4,d0
move.l #vew_wid,d5 ;max x view
move.l hogscr,d4 ;max y view
move.w pic_vew(a2),d1 ;viewmode add
btst #2,d1
beq.s grappln.nolace
add.l d4,d4 ;max y view
grappln.nolace
btst #15,d1 ;hires ?
beq.s grappln.nohi
move.l #vew_wid*2,d5 ;max x view
grappln.nohi
btst #6,d1 ;super hires ?
beq.s grappln.noshi
move.l #vew_wid*4,d5 ;max x view
grappln.noshi
moveq.l #0,d3 ;scherm centreren
move.w pic_wid(a2),d3 ;pic breedte in bytes
cmp.w d5,d3 ;breder dan scherm ?
ble.s grappln.qa
sub.w d5,d3 ;-scherm breedte
lsr.w #2,d3 ;/4
add.l d3,d3
add.l d3,d0
grappln.qa
move.w pic_hgt(a2),d3 ;pic hoogte in bytes
cmp.w d4,d3 ;hoger dan scherm ?
ble.s grappln.qb
sub.w d4,d3 ;-scherm breedte
lsr.w #1,d3 ;/2
moveq.l #0,d5
move.w pic_wid(a2),d5 ;pic breedte in bytes
muls pic_dpt(a2),d5
muls d5,d3
add.l d3,d0
grappln.qb
moveq.l #0,d2
move.w pic_wid(a2),d2
move.w pic_vew(a2),d5 ;interlace flipping ?
btst #2,d5
beq.s grappln.nolac7b
move.w $04(a6),d5 ;even/oneven ?
btst #15,d5
beq.s grappln.nolac7b
moveq.l #0,d3
move.w pic_wid(a2),d3
muls pic_dpt(a2),d3
add.l d3,d0
grappln.nolac7b
move.w pic_dpt(a2),d1 ;plnnummer 1 halen
tst.w d1 ;0 planes ?
beq.s grappln.end
sub.w #1,d1
grappln.a
move.w d0,3*2(a0)
swap d0
move.w d0,1*2(a0)
swap d0
add.l d6,a0 ;d6=copper step !
add.l d2,d0
dbra d1,grappln.a
grappln.end
movem.l (sp)+,d0-d7/a0-a6
rts
;sets palettes to copper
grac
movem.l d0-d7/a0-a6,-(sp)
lea curpal1,a3 ;palette 1
move.l #palette,a1
bsr.s gracfrm
lea curpal2,a3 ;palette 2 (dpl)
move.l #8*2+palette,a1
bsr.s gracfrm
bsr.s palctr ;palette-buffer to copper
grac.end
movem.l (sp)+,d0-d7/a0-a6
rts
;moves palette from picture to palette-buffer
gracfrm
movem.l d0-d7/a0-a6,-(sp)
tst.l (a3) ;palette aanwezig ?
beq.s gracfrm.end
move.l (a3),a2 ;current palette
cmp.l #'PALE',(a2) ;palette ?
bne.s gracfrm.pict
lea 6(a2),a0 ;palette
move.w 4(a2),d0 ;aantal kleuren
bra.s gracfrm.col
gracfrm.pict
cmp.l #'ANIM',(a2) ;animatie ?
bne.s gracfrm.noanim
moveq.l #0,d1
move.w pic_ani(a2),d1
bclr #7,d1 ;behandelbit weghalen
moveq.l #0,d3
move.w pic_wid(a2),d3
lsr.w #1,d3 ;/2
muls pic_hgt(a2),d3
muls pic_dpt(a2),d3
add.l d3,d3
add.l #pic_raw,d3
move.l d3,d5
btst #0,d1
bne.s gracfrm.buf2
moveq.l #0,d5
gracfrm.buf2
add.l d5,a2
gracfrm.noanim
lea pic_pal(a2),a0 ;palette
move.w pic_palnum(a2),d0
cmp.w #32-1,d0 ;niet meer dan 32 kleuren
ble gracfrm.sub
move.w #32-1,d0
gracfrm.sub
tst.w d0 ;0 planes ?
beq.s gracfrm.end
gracfrm.col
gracfrm.fa
move.w (a0)+,(a1)+
dbra d0,gracfrm.fa
gracfrm.end
movem.l (sp)+,d0-d7/a0-a6
rts
;handles colorcycling in the palette-buffer
;and copies palette-buffer to copper
palctr
movem.l d0-d7/a0-a6,-(sp)
move.l curpic1,a2 ;current raw
cmp.l #0,a2
beq.s palctr.qb
lea cycdel1,a3 ;cycle delays
move.l #palette,a4
bsr palcyc
palctr.qb
move.l curpic2,a2 ;current raw
cmp.l #0,a2
beq.s palctr.c
lea cycdel2,a3 ;cycle delays
move.l #8*2+palette,a4
bsr palcyc
palctr.c
lea gracprcol,a1
move.l #palette,a0
move.w 00(a0),00*4+2(a1)
move.w 02(a0),01*4+2(a1)
move.w 04(a0),02*4+2(a1)
move.w 06(a0),03*4+2(a1)
move.w 08(a0),04*4+2(a1)
move.w 10(a0),05*4+2(a1)
move.w 12(a0),06*4+2(a1)
move.w 14(a0),07*4+2(a1)
move.w 16(a0),08*4+2(a1)
move.w 18(a0),09*4+2(a1)
move.w 20(a0),10*4+2(a1)
move.w 22(a0),11*4+2(a1)
move.w 24(a0),12*4+2(a1)
move.w 26(a0),13*4+2(a1)
move.w 28(a0),14*4+2(a1)
move.w 30(a0),15*4+2(a1)
move.w 32(a0),16*4+2(a1)
move.w 34(a0),17*4+2(a1)
move.w 36(a0),18*4+2(a1)
move.w 38(a0),19*4+2(a1)
move.w 40(a0),20*4+2(a1)
move.w 42(a0),21*4+2(a1)
move.w 44(a0),22*4+2(a1)
move.w 46(a0),23*4+2(a1)
move.w 48(a0),24*4+2(a1)
move.w 50(a0),25*4+2(a1)
move.w 52(a0),26*4+2(a1)
move.w 54(a0),27*4+2(a1)
move.w 56(a0),28*4+2(a1)
move.w 58(a0),29*4+2(a1)
move.w 60(a0),30*4+2(a1)
move.w 62(a0),31*4+2(a1)
movem.l (sp)+,d0-d7/a0-a6
rts
;colorcyclinghandling of a palette
palcyc
movem.l d0-d7/a0-a6,-(sp)
move.w #4-1,d7 ;4 cycles
palcyc.d
tst.w (a3)+ ;delay klaar ?
bne.s palcyc.c
moveq.l #0,d1
move.b pic_cycstr(a2),d1 ;start color
lsl.b #1,d1 ;*2
moveq.l #0,d2
move.b pic_cycend(a2),d2 ;end color
lsl.b #1,d2 ;*2
moveq.l #0,d3
move.b pic_cycadd(a2),d3 ;richting
move.l a4,a0 ;palette pointer
move.l a0,a1
add.l d1,a0 ;startcolor
add.l d2,a1 ;endcolor
cmp.b #1,d3 ;omhoog
beq.s palcyc.up
cmp.b #3,d3 ;omlaag
beq.s palcyc.down
bra.s palcyc.i
palcyc.up ;kleuren copieren
move.w (a1),d4 ;laatst color bewaren
palcyc.f ;kleuren copieren
cmp.l a0,a1
beq.s palcyc.fa
move.w -(a1),2(a1)
bra palcyc.f
palcyc.fa
move.w d4,(a1)
bra.s palcyc.g
palcyc.down
move.w (a0),d4 ;laatst color bewaren
palcyc.h ;kleuren copieren
cmp.l a0,a1
beq.s palcyc.ha
move.w 2(a0),(a0)+
bra palcyc.h
palcyc.ha
move.w d4,(a1)
palcyc.g
move.b pic_cycspd(a2),-1(a3) ;delay zetten
bra.s palcyc.i
palcyc.c
sub.w #1,-2(a3) ;cycle delay aftellen
palcyc.i
add.l #4,a2 ;next cycle info
dbra d7,palcyc.d
palcyc.qb
movem.l (sp)+,d0-d7/a0-a6
rts
; SECTION variabelen,DATA_c
cnop 0,2
curtsk dc.l 0
tskpri dc.l 0
duplok dc.l 0
inttel dc.l 0
intdel dc.l 0
form dc.l 0
ifffil dc.l 0
intvbold dc.l 0
inttbeold dc.l 0
patpos dc.l 0
gfxlib dc.l 0
doslib dc.l 0
wbview dc.l 0
mt_data dc.l 0
memvid dc.l 0
oldcprlist dc.l 0
hogscr dc.l vew_hgt
inspos dc.l -1
anispd1 dc.w 1 ;nooit op 0 !
anispd2 dc.w 1
cnop 0,2
varclr.s ;start wissen
oldrot dc.l 0
curpic dc.l 0
curfrm dc.l 0
cycdel1 ds.w 4
cycdel2 ds.w 4
rotinf1 dc.w 0
rotinf2 dc.w 0
effspd dc.w 0
efflop dc.b 0
anilop1 dc.b 0
anilop2 dc.b 0
anipal1 dc.b 0
anipal2 dc.b 0
rotdpl dc.b 1
dplctr dc.b 0
cnop 0,2
insdat ds.l 4
inspri dc.l 0
instel dc.w 0
cureff dc.l 0
efftel dc.w 0
curpal1 dc.l 0
curpal2 dc.l 0
currot1 dc.l 0
currot2 dc.l 0
curpic1 dc.l 0
curpic2 dc.l 0
anitel1 dc.w 0
anitel2 dc.w 0
curfrm1 dc.l 0
curfrm2 dc.l 0
oldfrm1 dc.l 0
oldfrm2 dc.l 0
varclr.e
dc.l 0 ;wisruimte
varclr.ql equ varclr.e-varclr.s ;wislengte
;ownblit dc.b 0
ntscmode dc.b 0
end dc.b 0
pronam dc.b 'VideoTracker',0
cnop 0,2
dosnam dc.b 'dos.library',0
cnop 0,4
gfxnam dc.b 'graphics.library',0
cnop 0,4
cnop 0,4
gra.s
gracprscr
dc.w $8e,$3381,$90,$81c1,$92,$003c,$94,$00d0
gracprbpl
dc.w $100,$9000,$102,$0000,$104,$0020
dc.w $108,$0000,$10a,$0000
gracprpln
dc.w $e0,$0000,$e2,$0000
dc.w $e4,$0000,$e6,$0000
dc.w $e8,$0000,$ea,$0000
dc.w $ec,$0000,$ee,$0000
dc.w $f0,$0000,$f2,$0000
dc.w $f4,$0000,$f6,$0000
gracprcol
dc.w $180,0,$182,0,$184,0,$186,0,$188,0,$18a,0,$18c,0,$18e,0
dc.w $190,0,$192,0,$194,0,$196,0,$198,0,$19a,0,$19c,0,$19e,0
dc.w $1a0,0,$1a2,0,$1a4,0,$1a6,0,$1a8,0,$1aa,0,$1ac,0,$1ae,0
dc.w $1b0,0,$1b2,0,$1b4,0,$1b6,0,$1b8,0,$1ba,0,$1bc,0,$1be,0
cprjmp
dc.w $080,0,$082,0
gra.e
gra.ql equ gra.e-gra.s ;block lengte
cpr
dc.w $0001,$fffe
dc.w $09c,$8001 ;tbeint
cprspr
dc.w $120,$0000,$122,$0000
dc.w $124,$0000,$126,$0000
dc.w $128,$0000,$12a,$0000
dc.w $12c,$0000,$12e,$0000
dc.w $130,$0000,$132,$0000
dc.w $134,$0000,$136,$0000
dc.w $138,$0000,$13a,$0000
dc.w $13c,$0000,$13e,$0000
cprbuf
dc.w $8e,$3381,$90,$81c1,$92,$003c,$94,$00d0
dc.w $100,$9000,$102,$0000,$104,$0020
dc.w $108,$0000,$10a,$0000
dc.w $e0,$0000,$e2,$0000
dc.w $e4,$0000,$e6,$0000
dc.w $e8,$0000,$ea,$0000
dc.w $ec,$0000,$ee,$0000
dc.w $f0,$0000,$f2,$0000
dc.w $f4,$0000,$f6,$0000
dc.w $180,0,$182,0,$184,0,$186,0,$188,0,$18a,0,$18c,0,$18e,0
dc.w $190,0,$192,0,$194,0,$196,0,$198,0,$19a,0,$19c,0,$19e,0
dc.w $1a0,0,$1a2,0,$1a4,0,$1a6,0,$1a8,0,$1aa,0,$1ac,0,$1ae,0
dc.w $1b0,0,$1b2,0,$1b4,0,$1b6,0,$1b8,0,$1ba,0,$1bc,0,$1be,0
dc.w $080,0,$082,0
cprbuf.e
dc.w $088,$0000 ;copjmp2
dc.w $080,0,$082,0 ;moet achter cprbck blijven !
cprbck
sprdat
dc.w $ffff,$fffe
prf_pat equ 7 ;pref sample size
prf_patnum equ 128 ;aantal songpos's
prf_len equ ((prf_pat*prf_patnum)+1)
prf_pos equ 0 ;eff position (teller)
prf_effs equ 1 ;start effect (*prf_patnum)
prf_effe equ 2 ;end effect (*prf_patnum)
prf_pri equ 3 ;priority (*prf_patnum)
prf_spd equ 4 ;eff speed (*prf_patnum)
prf_ani equ 5 ;ani speed (*prf_patnum)
prf_roth equ 6 ;routine info (*prf_patnum)
prf_rotl equ 7 ;routine info (*prf_patnum)
eff_num equ 256 ;aantal effects
pic_wid equ 4 ;wide in bytes
pic_hgt equ 6 ;hoogte
pic_dpt equ 8 ;number planes
pic_ani equ 10 ;aantal effes (anim)
pic_vew equ 12 ;viewmode
pic_cycstr equ 14 ;cycle start (*4)
pic_cycend equ 15 ;cycle end (*4)
pic_cycspd equ 16 ;cycle speed (*4)
pic_cycadd equ 17 ;cycle add (*4)
pic_palnum equ 30 ;aantal kleuren
pic_pal equ 32 ;palette start
pic_palsiz equ 256*2 ;vaste palette size
pic_raw equ pic_pal+pic_palsiz ;palette start
fil_namlen equ 24 ;naamlengte
fil_len equ (fil_namlen+4+4) ;effect info length
fil_num equ 2+eff_num ;aantal files
fil_fil equ 0 ;file naam
fil_dir equ 24 ;pointer naar directory
fil_pnt equ 28 ;pointer naar meminfo
palette ds.w 64 ;palette
var_len equ $300 ;lengte vartabel
var__GfxBase equ $000 ;graphics lib
var_pic1 equ $004 ;current picture
var_anispd1 equ $008 ;animspeed
var_anitel1 equ $00c ;animspeed
var_cprbck equ $010 ;copperback
var_bck equ $014 ;background
var_pic2 equ $018 ;current picture
var_ntsc equ $01c ;ntsc/pal frequence
var_lnd equ $020 ;landscape
var_txt1 equ $040 ;text
var_txt16 equ 15*4+var_txt1
var_vec1 equ $080 ;vectors
var_vec16 equ 15*4+var_vec1
var_fon1 equ $0c0 ;fonts
var_fon16 equ 15*4+var_fon1
var_cols1 equ $100 ;colorsets
var_cols16 equ 15*4+var_cols1
var_obj1 equ $180 ;objects
var_obj16 equ 15*4+var_obj1
cnop 0,2
var ds.b $300 ;variabelen voor routines
; SECTION 10,CODE_C
endc
; this is the routine-source
;**********************************************************************
ifnd rout
pic_wid equ 4 ;wide in bytes
pic_hgt equ 6 ;hoogte
pic_dpt equ 8 ;number planes
pic_ani equ 10 ;aantal effes (anim)
pic_vew equ 12 ;viewmode
pic_cycstr equ 14 ;cycle start (*4)
pic_cycend equ 15 ;cycle end (*4)
pic_cycspd equ 16 ;cycle speed (*4)
pic_cycadd equ 17 ;cycle add (*4)
pic_palnum equ 30 ;aantal kleuren
pic_pal equ 32 ;palette start
pic_palsiz equ 256*2 ;vaste palette size
pic_raw equ pic_pal+pic_palsiz ;palette start
var_len equ $300 ;lengte vartabel
var__GfxBase equ $000 ;graphics lib
var_pic1 equ $004 ;current picture
var_anispd1 equ $008 ;animspeed
var_anitel1 equ $00c ;animspeed
var_cprbck equ $010 ;copperback
var_bck equ $014 ;background
var_pic2 equ $018 ;current picture
var_ntsc equ $01c ;ntsc/pal frequence
var_lnd equ $020 ;landscape
var_txt1 equ $040 ;text
var_txt16 equ 15*4+var_txt1
var_vec1 equ $080 ;vectors
var_vec16 equ 15*4+var_vec1
var_fon1 equ $0c0 ;fonts
var_fon16 equ 15*4+var_fon1
var_cols1 equ $100 ;colorsets
var_cols16 equ 15*4+var_cols1
var_obj1 equ $180 ;objects
var_obj16 equ 15*4+var_obj1
vew_wid equ 44
vew_hgt equ 290
win_hgt equ 117
win_str equ $1a
endc
;Test_Vec
;mx68882 ;gebruik 68882 routine
;copperspeed ;gebruik copperbar om snelheid te meten
;Nodraw ;tekent geen lijnen om snelheid beter te meten
; mc68882
; machine 68882 ;in devpac 3: Machine 68882 dacht ik...
;Ik heb dit met maxxon gemaakt...
;**********************************************************************
; assembleren met devpac, dan met hunkwizard of zoiets
; absoluut maken naar bijv. $80000 om de hunks enzo
; weg te halen, het eerste lonword moet "ROUT" zijn
; uiteindelijk, kijk uit dat hij volledig position-
; independent blijft (geeft devpac aan en hw ook)
;hier staan de picture-tabel offsets,begint met
;longword "PICT"
;vew_wid equ 44
;vew_hgt equ 290
;pic_wid equ 4 ;width in bytes
;pic_hgt equ 6 ;hoogte in lijnen
;pic_dpt equ 8 ;number of planes
;pic_ani equ 10 ;aantal frames (anim)
;pic_vew equ 12 ;viewmode (bplcon0)
;4 cycles mogelijk (deluxe paint)
;pic_cycstr equ 14 ;cycle start (*4)
;pic_cycend equ 15 ;cycle end (*4)
;pic_cycspd equ 16 ;cycle speed (*4)
;pic_cycadd equ 17 ;cycle add (*4)
;pic_palnum equ 30 ;aantal kleuren -1 (dbra)
;pic_pal equ 32 ;palette start
;pic_palsiz equ 256*2 ;vaste palette size
;256 kleuren mogelijk
;pic_raw equ pic_pal+pic_palsiz ;raw planes start
;zo opgebouwd:
;plane 0 row 0
;plane 1 row 0
;plane 2 row 0
;plane 0 row 1
;plane 1 row 1
;plane 2 row 1
;voor snellere blits
;dit is de vector-tabel, imagine en rot3d wordt
;in vt omgezet naar een eigen vector-tabel
;ik heb een losse voorbeeld.bin erbij gepacked
;begint met "VECT"
vec_xyzlen equ $4 ;lengte xyzc tabel
;xyzc tabel:
;aantal xyzc's -1 word
;x,y,z coordinaten en c (kleur) in words
vec_pollen equ $8 ;lengte polygoon tabel
;polygonen tabel: (uit mijn hoofd, bugvrij ?)
;aantal poly's -1 word
;poly 1 aantal lijnen -1 word
;poly 1 lijn 1 xyzc 1 xyzc 2 word,word,xyzc-tabel nummer
;poly 1 lijn 2 xyzc 1 xyzc 2 word,word
;etc.
vec_palnum equ $10 ;aantal kleuren -1 (dbra)
vec_pal equ $12 ;palette in words (256)
vec_xyz equ 256*2+vec_pal ;start xyzc tabel
vec_xyznum equ vec_xyz ;aantal xyzc's
;de variabelen-tabel, geeft nuttige informatie
;voor de routines
;de huidige tabel bevat meer info maar dat heeft de
;vectorroutine toch niet nodig
;var_gfxlib equ $000 ;graphics lib
;var_pic equ $004 ;current picture 1
;var_anispd1 equ $008 ;animspeed
;var_anitel1 equ $00c ;animspeed
;var_cprbck equ $010 ;copperback
;var_bck equ $014 ;background
;var_ntsc equ $01c ;frequency
;var_txt1 equ $040 ;text
;var_txt16 equ 15*4+var_txt1
;var_fon1 equ $0c0 ;fonts
;var_fon16 equ 15*4+var_fon1
;var_vec1 equ $080 ;vectors
;var_vec64 equ 63*4+var_vec1
;var_obj1 equ $180 ;objects
;var_obj64 equ 63*4+var_obj1
rot_vewh equ 0;$8000 ;bplcon0 width-mode low-res/hi-res
rot_vewl equ 0;$4 ;bplcon0 heigth-mode no-lace/interlace
rot_vew equ rot_vewh+rot_vewl
rot_dpt equ 1 ;aantal planes (depth)
;shade ;als dit label aan staat, is het de vectorshade routine
;(1 plane,6 buffers,copperlijst)
ifeq rot_vewh-0
ifeq rot_dpt-1
rot_blit equ 1 ;aantal clear blits
endc
ifeq rot_dpt-2
rot_blit equ 1 ;aantal clear blits
endc
ifeq rot_dpt-3
rot_blit equ 1 ;aantal clear blits
endc
ifeq rot_dpt-4
rot_blit equ 2 ;aantal clear blits
endc
ifeq rot_dpt-5
rot_blit equ 2 ;aantal clear blits
endc
ifeq rot_dpt-6
rot_blit equ 2 ;aantal clear blits
endc
endc
ifeq rot_vewh-$8000
ifeq rot_dpt-1
rot_blit equ 1 ;aantal clear blits
endc
ifeq rot_dpt-2
rot_blit equ 2 ;aantal clear blits
endc
ifeq rot_dpt-3
rot_blit equ 2 ;aantal clear blits
endc
ifeq rot_dpt-4
rot_blit equ 2 ;aantal clear blits
endc
endc
ifeq rot_vewh-0
bck_wid equ vew_wid ;view width
rot_wid equ (384/8) ;breedte planes
rot_drot equ 256 ;max. grote vectorobj
rot_cen equ 0
endc
ifeq rot_vewh-$8000
bck_wid equ vew_wid*2
rot_wid equ (384/8)*2
rot_drot equ 256*2
rot_cen equ 8
endc
ifeq rot_vewl-$0
bck_hgt equ vew_hgt ;viewable hoogte
rot_hgt equ 384 ;hoogte planes
endc
ifeq rot_vewl-$4
bck_hgt equ vew_hgt*2
rot_hgt equ 384*2
endc
SECTION 3,CODE_c
; a0=variabelen tabel (adres tabel)
; d0=routinfo (routinemode-waarde)
rot
dc.l 'ROUT' ;effect-longword-ID
movem.l d2-d7/a1-a6,-(sp)
lea rot,a6 ;a6 prog base (zorgt ervoor
;dat deze routine overal
;in het geheugen kan staan)
lea ($dff000).l,a5 ;a5 gebruikt ik in de hele file
ifd shade
lea rotcop,a1 ;copperback invullen
move.l var_cprbck(a0),d1 ;copperlist terugjump
sub.l #8,d1 ;adres naar vt-copperlist
move.w d1,6(a1)
swap d1
move.w d1,2(a1)
endc
ifnd shade
lea rotpal1,a3 ;palette van zichtbare
move.l a3,a4 ;buffer naar werkbuffer
move.l real-rot(a6),d1
add.l d1,a3 ;destination
eor.l #(rotpic2-rotpic1),d1
add.l d1,a4 ;source
move.w #1,d1
lsl.w #rot_dpt,d1
sub.w #1,d1
rotpalcop.c ;palette
move.w (a4)+,(a3)+
dbra d1,rotpalcop.c
endc
lea var_obj1(a0),a2 ;copy current balls
lea rotbaltab-rot(a6),a1
move.w #16-1,d1
rotbal.cop
move.l (a2)+,(a1)+
dbra d1,rotbal.cop
tst.l var_vec1(a0) ;nieuwe vector ?
beq.s rot.novec
move.l var_vec1(a0),a1 ;halen
clr.l var_vec1(a0) ;wissen
cmp.l curvec-rot(a6),a1 ;zelfde ?
beq.s rot.novec ;palette niet copieren
move.l a1,curvec-rot(a6) ;current vector
ifnd shade
move.w vec_palnum(a1),d1
cmp.w #-1,d1 ;geen kleuren ?
beq.s rot.novec
move.w #1,d2 ;maximale color check
lsl.w #rot_dpt,d2
sub.w #1,d2
cmp.w d2,d1
ble.s rotpalcop.a
move.w d2,d1
rotpalcop.a ;vector palette copieren
lea vec_pal(a1),a2
lea rotpal1,a3
add.l real-rot(a6),a3 ;get current workbuffer
rotpalcop.bx
move.w (a2)+,(a3)+
dbra d1,rotpalcop.bx
endc
rot.novec
tst.l curvec-rot(a6) ;vector aanwezig ?
beq rot.end
move.l curvec-rot(a6),a1
cmp.l #'VECT',(a1) ;file nog actueel ?
bne rot.end
clr.l d1 ;info ombouwen
move.l d0,d1
divs #8192,d1
and.l #$ffff,d1
tst.b d1
beq.s rot.norotclr
clr.w XROT-rot(a6) ;xyz clear
clr.w YROT-rot(a6)
clr.w ZROT-rot(a6)
rot.norotclr
muls #8192,d1
sub.l d1,d0
move.l d0,d1
divs #4096,d1
and.l #$ffff,d1
move.b d1,clrmod-rot(a6) ;clear on/off
muls #4096,d1
sub.l d1,d0
move.l d0,d1
divs #2048,d1
and.l #$ffff,d1
move.b d1,bufmod-rot(a6) ;double buffer on/off
muls #2048,d1
sub.l d1,d0
move.l d0,d1
divs #128,d1
and.l #$ffff,d1
move.l d1,d7
add.l #1,d7
muls #2,d7 ;d7 snelheid (add)
muls #128,d1
sub.l d1,d0
move.w d0,d1
divs #64,d1
and.l #$ffff,d1
move.w d1,d3 ;d3 richting (d mov)
muls #64,d1
sub.w d1,d0
move.w d0,d1
divs #8,d1
and.l #$ffff,d1
move.w d1,d2 ;d2 type line/pix/ball
muls #8,d1
sub.w d1,d0
move.w d0,d1
divs #4,d1
and.l #$ffff,d1
move.w d1,d6 ;d6 x rot
muls #4,d1
sub.w d1,d0
move.w d0,d1
divs #2,d1
and.l #$ffff,d1
move.w d1,d5 ;d5 y rot
muls #2,d1
sub.w d1,d0
move.w d0,d4 ;d4 z rot
muls d7,d6
muls d7,d5
muls d7,d4
move.w d6,xadd-rot(a6)
move.w d5,yadd-rot(a6)
move.w d4,zadd-rot(a6)
move.w d3,dway-rot(a6)
move.w d7,dadd-rot(a6)
tst.b clrmod-rot(a6) ;clear off ?
bne.s rot.noclear
movem.l d0-d7/a0-a6,-(sp) ;clear screen
lea rotpln1,a3 ;plane + centreren
add.l #((rot_hgt-bck_hgt)/2*rot_wid*rot_dpt)+((rot_wid-bck_wid)/4*2),a3
add.l real-rot(a6),a3
move.w #0,$042(a5)
move.w #$100+$f0,$040(a5)
move.w #rot_wid-bck_wid,$064(a5)
move.w #rot_wid-bck_wid,$066(a5)
move.w #0,$074(a5) ;a dat
move.l #0,$044(a5) ;mask
move.w #rot_blit-1,d0
rot.blit1
move.l a3,$054(a5) ;destination
move.w #((bck_hgt/rot_blit)*rot_dpt)*64+(bck_wid/2),$058(a5)
bsr rot.wblit
add.l #(bck_hgt/rot_blit)*rot_dpt*rot_wid,a3
dbra d0,rot.blit1
movem.l (sp)+,d0-d7/a0-a6
rot.noclear
tst.b d2
bne.s rot.typa
bsr VECTOR ;calc coords
bsr rot.pxl ;pixel
bra.s rot.typend
rot.typa
cmp.b #1,d2
bne.s rot.typb
bsr VECTOR ;calc coords
bsr rotlin ;lijnen
bra.s rot.typend
rot.typb
cmp.b #2,d2
bne.s rot.typc
bsr VECTOR ;calc coords
bsr rotgls ;glas
bra.s rot.typend
rot.typc
cmp.b #3,d2
bne.s rot.typd
bsr VECTOR ;calc coords
bsr rotfil ;solide
bra.s rot.typend
rot.typd
cmp.b #4,d2
bne.s rot.type
bsr VECTOR ;calc coords
bsr rot.bal ;ballen
bra.s rot.typend
rot.type
cmp.b #5,d2
bne.s rot.typf
bsr VECTOR ;calc coords
bsr rotsym ;symetrisch solide
bra rot.typend
rot.typf
rot.typend
move.w xadd-rot(a6),d0
move.w yadd-rot(a6),d1
move.w zadd-rot(a6),d2
move.w dadd-rot(a6),d3
move.w dway-rot(a6),d4
add.w d0,XROT-rot(a6) ;hoek draaing
add.w d1,YROT-rot(a6)
add.w d2,ZROT-rot(a6)
btst #0,d4
bne.s rot.px
add.w d3,DROT-rot(a6)
bra.s rot.q
rot.px
sub.w d3,DROT-rot(a6)
rot.q
cmp.w #718,XROT-rot(a6) ;vergelijkingen
ble.s NOP1
sub.w #718,XROT-rot(a6)
NOP1: cmp.w #718,YROT-rot(a6)
ble.s NOP2
sub.w #718,YROT-rot(a6)
NOP2:
cmp.w #718,ZROT-rot(a6)
ble.s NOP3
sub.w #718,ZROT-rot(a6)
NOP3:
cmp.w #rot_drot,DROT-rot(a6)
ble.s NOP4
move.w #rot_drot,DROT-rot(a6)
NOP4
cmp.w #0,DROT-rot(a6)
bge.s NOP5
move.w #0,DROT-rot(a6)
NOP5
GETMEOUT:
rot.end
clr.l d1
ifd shade
lea rotcop,a1
move.l a1,d1 ;copperlist
lea rotpic1,a2 ;raw rotplanes
move.l real-rot(a6),d2
move.w #4-1,d4
rotend.kb
sub.l #(rotpic2-rotpic1),d2
cmp.l #0-(rotpic2-rotpic1),d2
bne rotend.ka
move.l #5*(rotpic2-rotpic1),d2
rotend.ka
move.l a2,d3
add.l d2,d3
move.l #((rot_hgt-vew_hgt)/2*rot_wid*rot_dpt)+((rot_wid-vew_wid)/2)+(rotpln1-rotpic1),d6
cmp.b #50,var_ntsc(a0)
beq rotend.pal
move.l #((rot_hgt-(vew_hgt-56))/2*rot_wid*rot_dpt)+((rot_wid-vew_wid)/2)+(rotpln1-rotpic1),d6
rotend.pal
add.l d6,d3
move.w d3,$e(a1)
swap d3
move.w d3,$a(a1)
add.l #8,a1
dbra d4,rotend.kb
endc
lea rotpic1,a0 ;raw rotplanes
move.l real-rot(a6),d0 ;get scherm 2
tst.b bufmod-rot(a6) ;buffer on/off
bne.s rot.end2
ifnd shade
eor.l #(rotpic2-rotpic1),real-rot(a6) ;real=scherm 2
endc
ifd shade
move.l real-rot(a6),d2
add.l #(rotpic2-rotpic1),d2
cmp.l #6*(rotpic2-rotpic1),d2
bne rotend.k
clr.l d2
rotend.k
move.l d2,real-rot(a6)
endc
rot.end2
add.l d0,a0
movem.l (sp)+,d2-d7/a1-a6
rts
rot.wblit
btst #6,$002(a5)
bne rot.wblit
rts
rot.bal
movem.l d0-d7/a0-a6,-(sp)
move.w #%1111111111111111,$044(a5)
move.w #%1111111111111111,$046(a5)
move.l rotbaltab-rot(a6),a1
cmp.l rotpal-rot(a6),a1 ;nieuwe bal ?
beq.s rot.bala
move.l a1,rotpal-rot(a6) ;en opslaan
ifnd shade
cmp.w #rot_dpt,pic_dpt(a1) ;depth hetzelfde ?
bne.s rot.bala
move.w pic_palnum(a1),d0
lea pic_pal(a1),a1
lea rotpal1,a2
add.l real-rot(a6),a2
rot.balpal
move.w (a1)+,(a2)+
dbra d0,rot.balpal
endc
rot.bala
clr.l d0
clr.l d1
clr.l d2
clr.l d3
clr.l d4
rot.balb
move.l curvec-rot(a6),a4
add.l #vec_xyz,a4 ;info overslaan
lea xy,a2
move.l #$7fff,d5
move.w (a4)+,d7 ;aantal xyZ's-1 vanwege DBF_commando
rot.zaadbal
move.w 4(a2),d3 ;z
beq.s rot.zaadbala ;0 ?
cmp.w d5,d3 ;groter ?
bgt.s rot.zaadbala
move.w d3,d5 ;kleinste z bewaren
move.l a2,a3 ;xyz posiite bewaren
move.l a4,a1 ;kleur positie bewaren
rot.zaadbala
lea 6(a2),a2
lea 8(a4),a4
dbra d7,rot.zaadbal
cmp.w #$7fff,d5 ;klaar ?
beq.s rot.balend
moveq.l #0,d4
move.w 6(a1),d4 ;kleur
add.w d4,d4
add.w d4,d4 ;*4
movem.w (a3),d0/d1/d3 ;x,y,z
bsr.s rotobj ;a0,d0,d1,d4
clr.w 4(a3) ;z wissen
bra rot.balb
rot.balend
movem.l (sp)+,d0-d7/a0-a6
rts
rotobj ;d3
movem.l d0-d7/a0-a6,-(sp)
lea rotbaltab,a0
add.l d4,a0
tst.l (a0) ;ball file ?
beq rotobj.end
move.l (a0),a0
cmp.l #'OBJE',(a0) ;nog levend ?
bne rotobj.end
cmp.w #rot_dpt,pic_dpt(a0) ;depth hetzelfde ?
bne rotobj.end
move.l real-rot(a6),d6 ;get scherm 2
lea rotpln1,a1
add.l d6,a1
clr.l d2 ;centreer x
move.w pic_wid(a0),d2
sub.l #2,d2 ;-blitterscrollruimte
lsl.l #2,d2 ;*8/2
sub.l d2,d0
clr.l d2 ;centreer y
move.w pic_hgt(a0),d2
lsr.l #1,d2 ;/2
sub.l d2,d1
move.l d0,d2
lsr.l #4,d0 ;ruwe xpos
lsl.l #1,d0
add.l d0,a1
muls #rot_wid*rot_dpt,d1 ;ypos
add.l d1,a1
clr.l d6
move.w pic_wid(a0),d6 ;bltsize berekenen
lsr.w #1,d6 ;/2
clr.l d5
move.w pic_hgt(a0),d5
muls pic_dpt(a0),d5
lsl.w #6,d5 ;*64 voor bltsize
add.w d5,d6
lsl.l #3,d0 ;bitscroll verder bereken
sub.l d0,d2
lsl.w #8,d2
lsl.w #4,d2
move.w d2,$42(a5) ;bltcon1
add.w #$0fca,d2
move.w d2,$40(a5) ;bltcon0
rotobj.da
clr.l d5
move.w pic_ani(a0),d5 ;aantal brushes
move.l #256,d4 ;maximale z !
divs d5,d4
and.l #$ffff,d4
and.l #$ffff,d3
divs d4,d3
and.l #$ffff,d3
clr.l d5
move.w pic_wid(a0),d5 ;breedte
muls pic_hgt(a0),d5 ;hoogte
muls pic_dpt(a0),d5 ;plnnumes
move.l d5,d7
add.l d5,d5 ;plus mask
muls d3,d5 ;anipos
lea pic_raw(a0),a4 ;obj picture
add.l d5,a4
move.l a4,a3
add.l d7,a3 ;obj mask
move.l #rot_wid,d7
sub.w pic_wid(a0),d7
move.w d7,$60(a5) ;bltcmod
move.w d7,$66(a5) ;bltdmod
move.w #0,$62(a5) ;bltbmod
move.w #0,$64(a5) ;bltamod
clr.l d3
move.w pic_dpt(a0),d3 ;bck opslaan
rotobj.a
move.l a1,$48(a5) ;bltcpt destination
move.l a4,$4c(a5) ;bltbpt picture
move.l a3,$50(a5) ;bltapt mask
move.l a1,$54(a5) ;bltdpt destination
move.w d6,$58(a5) ;bltsize
bsr rot.wblit
rotobj.bx
rotobj.end
movem.l (sp)+,d0-d7/a0-a6
rts
rot.pxl ;pixels zetten
movem.l d0-d7/a0-a6,-(sp)
clr.l d0
clr.l d1
clr.l d3
clr.l d4
lea xy,a2
move.l #rot_wid,d6
move.l #rot_wid*rot_dpt,d5 ;y
move.l #7,d4 ;x bit 8
move.l curvec-rot(a6),a1
add.l #vec_xyz,a1
move.w (a1)+,d7 ;aantal xyZ's-1 vanwege DBF_commando
lea rotpln1,a0
add.l real-rot(a6),a0 ;get scherm 2
add.l #(rot_dpt-1)*rot_wid,a0
move.l a0,a3
rot.pxla
ifeq 1-rot_dpt
movem.w (a2)+,d0-d1/d3 ;xyz
; muls d5,d1 ;y
ifeq rot_wid-(384/8*2) ;*96
lsl.w #5,d1 ;*32
move.w d1,d3
add.w d1,d1 ;*2
add.w d3,d1
endc
ifeq rot_wid-(384/8) ;*48
lsl.w #4,d1 ;*16
move.w d1,d3
add.w d1,d1 ;*2
add.w d3,d1
endc
move.w d0,d2
lsr.w #3,d2 ;/8
add.w d2,d1
move.w d4,d2
and.w d4,d0 ;x bit 8
sub.w d0,d2
move.l a3,a0
add.l d1,a0
bset d2,(a0)
dbra d7,rot.pxla
endc
iflt 1-rot_dpt
movem.w (a2)+,d0-d1/d3 ;xyz
move.w 6(a1),d3 ;kleur
add.l #8,a1
muls d5,d1 ;y
move.w d0,d2
lsr.w #3,d2 ;/8
add.w d2,d1
move.w d4,d2
and.w d4,d0 ;x bit 8
sub.w d0,d2
move.l a3,a0
add.l d1,a0
move.w #rot_dpt-1,d0
rot.pxlb
btst d0,d3
beq rot.pxlc
bset d2,(a0)
rot.pxlc
sub.l d6,a0
dbra d0,rot.pxlb
dbra d7,rot.pxla
rot.pxlx
endc
movem.l (sp)+,d0-d7/a0-a6
rts
;DRAWLINE-ROUTINE
;d0 = x1
;d1 = y1
;d2 = x2
;d3 = y2
;uses d0-d6
rotlin ;lijntjes trekken, joepie !
movem.l d0-d7/a0-a6,-(sp)
move.l curvec-rot(a6),a1
add.l 4(a1),a1
add.l #vec_xyz,a1 ;info overslaan
lea xy,a2
clr.l d4
move.w (a1)+,d6 ;aantal poly's
cmp.w #-1,d6 ;geen ?
beq.s rotlin.end
rotlin.a
move.w (a1)+,d7 ;aantal lijnen
lea 2(a1),a1 ;kleur overslaan
rotlin.bx
move.w (a1)+,d4
subq.w #1,d4
muls #6,d4
movem.w (a2,d4.w),d0-d1
move.w (a1)+,d4
subq.w #1,d4
muls #6,d4
movem.w (a2,d4.w),d2-d3
bsr DRAWLINE ;lijn tekenen
dbra d7,rotlin.bx
; lea 2(a1),a1
dbra d6,rotlin.a
rotlin.end
movem.l (sp)+,d0-d7/a0-a6
rts
rotfil ;solid poly's
movem.l d0-d7/a0-a6,-(sp)
bsr line_init1 ;eventueel tabel vullen
lea xy,a2
bsr rotsor ;poly's sorteren
cmp.w #-1,d1 ;geen ?
beq rotfil.end
move.w d1,d3 ;aantal polies
move.w d1,d4 ;aantal polies
rotfil.fa
lea rotdontab,a4 ;done tabel
sub.l a1,a1
move.w #$7fff,d6 ;maximale z positie
move.w d3,d2 ;aantal poly's
rotfil.ca
move.w 4(a4),d0 ;poly z
beq.s rotfil.aa ;leeg ?
cmp.w d6,d0 ;z positie groter ?
bge.s rotfil.aa
move.l a4,a1
move.w d0,d6
rotfil.aa
lea 6(a4),a4
dbra d2,rotfil.ca
cmp.l #0,a1
beq rotfil.end ;voortijdige ejaculatie
clr.w 4(a1) ;poly wissen
movem.l d0-d7/a0-a6,-(sp)
move.l (a1),a1 ;poly halen
move.w (a1)+,d7 ;aantal lijnen
move.w (a1)+,a0 ;kleur
moveq.l #0,d0
moveq.l #0,d1
moveq.l #0,d2
moveq.l #0,d3
move.l #$7fff,d4 ;minimale x
move.l #$7fff,d5 ;minimale y
sub.l a3,a3 ;maximale x
sub.l a4,a4 ;maximale y
rotfil.bx
move.w (a1)+,d2
subq.w #1,d2
muls #6,d2
movem.w (a2,d2.w),d0-d1 ;x1,y1
move.w (a1)+,d2
subq.w #1,d2
muls #6,d2
movem.w (a2,d2.w),d2-d3 ;x2,y2
bsr line ;lijn tekenen
cmp.w d4,d0 ;minimale x halen
bge.s rotfil.ba
move.w d0,d4
rotfil.ba
cmp.w d4,d2
bge.s rotfil.bb
move.w d2,d4
rotfil.bb
cmp.w d5,d1 ;minimale y halen
bge.s rotfil.bc
move.w d1,d5
rotfil.bc
cmp.w d5,d3
bge.s rotfil.bd
move.w d3,d5
rotfil.bd
move.l a3,d6
cmp.w d6,d0 ;maximale x halen
ble.s rotfil.be
move.w d0,a3
rotfil.be
cmp.w d6,d2
ble.s rotfil.bf
move.w d2,a3
rotfil.bf
move.l a4,d6
cmp.w d6,d1 ;maximale y halen
ble.s rotfil.bg
move.w d1,a4
rotfil.bg
cmp.w d6,d3
ble.s rotfil.bh
move.w d3,a4
rotfil.bh
dbra d7,rotfil.bx
bsr rotpolfil
rotfil.noline
movem.l (sp)+,d0-d7/a0-a6
rotfil.ea
dbra d4,rotfil.fa
rotfil.end
movem.l (sp)+,d0-d7/a0-a6
rts
rotsym ;solid lines
movem.l d0-d7/a0-a6,-(sp)
bsr line_init1 ;eventueel tabel vullen
lea xy,a2
bsr rotsor ;poly's sorteren d1=aantal
cmp.w #-1,d1 ;geen ?
beq rotsym.end
move.w d1,d3 ;aantal polies
add.w #2,d1
lsr.w #1,d1 ;/2
sub.w #1,d1
tst.w d1
beq.s rotsym.plot ;maar 1 poly !
move.w d1,d4 ;aantal te wissen polies
rotsym.f
lea rotdontab,a4 ;done tabel
move.w #$7fff,d6 ;maximale z positie
move.w d3,d2 ;aantal poly's
rotsym.c
move.w 4(a4),d0 ;poly z
beq.s rotsym.a ;leeg ?
cmp.w d6,d0 ;z positie groter ?
bgt.s rotsym.a
move.l a4,a1
move.w d0,d6
rotsym.a
lea 6(a4),a4
dbra d2,rotsym.c
clr.w 4(a1) ;poly wissen
rotsym.e
dbra d4,rotsym.f
rotsym.plot
move.w d3,d4 ;aantal polies
sub.w d1,d4 ;- aantal te wissen polies
rotsym.fa
lea rotdontab,a4 ;done tabel
sub.l a1,a1
move.w #$7fff,d6 ;maximale z positie
move.w d3,d2 ;aantal poly's
rotsym.ca
move.w 4(a4),d0 ;poly z
beq.s rotsym.aa ;leeg ?
cmp.w d6,d0 ;z positie groter ?
bge.s rotsym.aa
move.l a4,a1
move.w d0,d6
rotsym.aa
lea 6(a4),a4
dbra d2,rotsym.ca
cmp.l #0,a1
beq rotsym.end ;voortijdige ejaculatie
clr.w 4(a1) ;poly wissen
movem.l d0-d7/a0-a6,-(sp)
move.l (a1),a1 ;poly halen
move.w (a1)+,d7 ;aantal lijnen
move.w (a1)+,a0 ;kleur
moveq.l #0,d0
moveq.l #0,d1
moveq.l #0,d2
moveq.l #0,d3
move.l #$7fff,d4 ;minimale x
move.l #$7fff,d5 ;minimale y
sub.l a3,a3 ;maximale x
sub.l a4,a4 ;maximale y
rotsym.bx
move.w (a1)+,d2
subq.w #1,d2
muls #6,d2
movem.w (a2,d2.w),d0-d1 ;x1,y1
move.w (a1)+,d2
subq.w #1,d2
muls #6,d2
movem.w (a2,d2.w),d2-d3 ;x2,y2
bsr line ;lijn tekenen
cmp.w d4,d0 ;minimale x halen
bge.s rotsym.ba
move.w d0,d4
rotsym.ba
cmp.w d4,d2
bge.s rotsym.bb
move.w d2,d4
rotsym.bb
cmp.w d5,d1 ;minimale y halen
bge.s rotsym.bc
move.w d1,d5
rotsym.bc
cmp.w d5,d3
bge.s rotsym.bd
move.w d3,d5
rotsym.bd
move.l a3,d6
cmp.w d6,d0 ;maximale x halen
ble.s rotsym.be
move.w d0,a3
rotsym.be
cmp.w d6,d2
ble.s rotsym.bf
move.w d2,a3
rotsym.bf
move.l a4,d6
cmp.w d6,d1 ;maximale y halen
ble.s rotsym.bg
move.w d1,a4
rotsym.bg
cmp.w d6,d3
ble.s rotsym.bh
move.w d3,a4
rotsym.bh
dbra d7,rotsym.bx
bsr rotpolfil
rotsym.noline
movem.l (sp)+,d0-d7/a0-a6
rotsym.ea
dbra d4,rotsym.fa
rotsym.end
movem.l (sp)+,d0-d7/a0-a6
rts
rotsor ;polies sorteren
movem.l d2-d7/a0-a6,-(sp)
move.l curvec-rot(a6),a1
add.l 4(a1),a1
add.l #vec_xyz,a1 ;info overslaan
lea rotdontab,a4 ;done tabel wissen
moveq.l #0,d7
move.w (a1)+,d6 ;aantal polies
move.w d6,d1
cmp.w #-1,d1 ;geen ?
beq.s rotsor.end
rotsor.h
move.w (a1),d7 ;aantal lijnen
move.w d7,d3 ;aantal lijnen
add.w #1,d3
move.l a1,(a4)+ ;poly opslaan
lea 4(a1),a1 ;+kleur
moveq.l #0,d0 ;gemiddelde z positie
; moveq.l #0,d2
moveq.l #0,d4 ;gemiddelde z positie
rotsor.dx
move.w (a1)+,d2 ;coordinaat nummer
subq.w #1,d2
muls #6,d2
move.w 4(a2,d2.w),d4 ;z
lea 2(a1),a1 ;2de coordinaat overslaan
; cmp.w d2,d4
; ble rotsor.da
; move.w d4,d2
;rotsor.da
add.l d4,d0
dbra d7,rotsor.dx
; add.l d2,d0 ;+hoogste z-positie
divs d3,d0 ;/aantal lijnen
move.w d0,(a4)+ ;poly gem. z opslaan
; lea 2(a1),a1
dbra d6,rotsor.h
rotsor.g
rotsor.end
movem.l (sp)+,d2-d7/a0-a6
rts
rotgls ;solid lines
movem.l d0-d7/a0-a6,-(sp)
bsr line_init1 ;eventueel tabel vullen
move.l curvec-rot(a6),a1
add.l 4(a1),a1
add.l #vec_xyz,a1 ;info overslaan
move.w (a1)+,d6 ;aantal polies
cmp.w #-1,d6 ;geen ?
beq rotgls.end
lea xy,a2
rotgls.a
move.w (a1)+,d7 ;aantal lijnen
move.w (a1)+,a0 ;kleur
moveq.l #0,d0
moveq.l #0,d1
moveq.l #0,d2
moveq.l #0,d3
move.l #$7fff,d4 ;minimale x
move.l #$7fff,d5 ;minimale y
sub.l a3,a3 ;maximale x
sub.l a4,a4 ;maximale y
rotgls.bx
move.w (a1)+,d2
subq.w #1,d2
muls #6,d2
movem.w (a2,d2.w),d0-d1 ;x1,y1
move.w (a1)+,d2
subq.w #1,d2
muls #6,d2
movem.w (a2,d2.w),d2-d3 ;x2,y2
bsr line ;lijn tekenen
cmp.w d4,d0 ;minimale x halen
bge.s rotgls.ba
move.w d0,d4
rotgls.ba
cmp.w d4,d2
bge.s rotgls.bb
move.w d2,d4
rotgls.bb
cmp.w d5,d1 ;minimale y halen
bge.s rotgls.bc
move.w d1,d5
rotgls.bc
cmp.w d5,d3
bge.s rotgls.bd
move.w d3,d5
rotgls.bd
move.l d6,-(sp)
move.l a3,d6
cmp.w d6,d0 ;maximale x halen
ble.s rotgls.be
move.w d0,a3
rotgls.be
cmp.w d6,d2
ble.s rotgls.bf
move.w d2,a3
rotgls.bf
move.l a4,d6
cmp.w d6,d1 ;maximale y halen
ble.s rotgls.bg
move.w d1,a4
rotgls.bg
cmp.w d6,d3
ble.s rotgls.bh
move.w d3,a4
rotgls.bh
move.l (sp)+,d6
dbra d7,rotgls.bx
bsr rotpolgls
dbra d6,rotgls.a
rotgls.end
movem.l (sp)+,d0-d7/a0-a6
rts
rotpolfil ;d4/d5/a3/a4
movem.l d0-d7/a0-a6,-(sp)
lea rotpln1,a2
move.l a2,a1
add.l #rotplnw-rotpln1,a1 ;workplane
add.l real-rot(a6),a2 ;get scherm 2
move.w #rot_wid,d7 ;wordt modulo
sub.w #16,d4 ;ruimte voor min x
add.w #16,a3 ;ruimte voor max x
; sub.w #2,d5 ;ruimte voor min y
add.w #1,a4 ;ruimte voor max y
move.w a4,d0 ;maximale y
sub.w d5,d0 ;-minimale y
move.w d0,d2 ;y hoogte (in lijnen)
lsl.w #6,d0 ;*64
move.w a3,d1 ;maximale x
sub.w d4,d1 ;-minimale x
lsr.w #4,d1 ;/16
move.w d1,d3 ;x breedte (in words)
add.w d1,d0 ;bltsize
muls #rot_wid,d5 ;minimale y
add.l d5,a1 ;+workplane
lsr.l #1,d5 ;/2 (voor hi-res)
muls #rot_dpt,d5 ;minimale y
lsl.l #1,d5 ;*2
add.l d5,a2 ;+destination scherm
lsr.w #4,d4 ;/16 minimale x
lsl.w #1,d4 ;*2 minimale x
add.l d4,a1 ;+workplane
add.l d4,a2 ;+destination scherm
muls #rot_wid,d2 ;y hoogte
lsl.w #1,d3 ;*2 x breedte
sub.w d3,d7 ;module aftrekken
add.l d3,d2
move.l a1,a3 ;workscherm bewaren
add.l d2,a1 ;reverse fill add
move.l a1,$4c(a5) ;bltbpt
move.l a1,$54(a5) ;bltdpt
move.w d7,$62(a5) ;bltbmod
move.w d7,$66(a5) ;bltdmod
move #%0000010111001100,$40(a5) ;bltcon0
move #%0000000000010010,$42(a5) ;bltcon1
move d0,$58(a5) ;bltsiz
bsr rot.wblit ;wait for blit
add.l #2,a3 ;reverse ?
add.l #2,a2 ;reverse ?
move.w #$f00+$ca,$040(a5) ;bltcon0
move.w #0,$042(a5) ;bltcon1
move.l #-1,$044(a5) ;mask
move.w d7,d6
add.w #rot_wid*(rot_dpt-1),d6
move.w d6,$60(a5) ;bltcmod
move.w d7,$62(a5) ;bltbmod
move.w d7,$64(a5) ;bltamod
move.w d6,$66(a5) ;bltdmod
move.w a0,d6 ;kleur halen
move.l a3,a4 ;empty positie
add.l #rotplne-rotplnw,a4
add.l #rot_wid*(rot_dpt-1),a2
move.w #rot_dpt-1,d1
rotpolfil.a
move.l a3,d2
btst d1,d6 ;kleurnbit test
; beq rotpolfil.bx ;doorschijnend
bne.s rotpolfil.c
move.l a4,d2 ;solid
rotpolfil.c
move.l a2,$48(a5) ;bltcpt destination
move.l d2,$4c(a5) ;bltbpt picture
move.l a3,$50(a5) ;bltapt mask
move.l a2,$54(a5) ;bltdpt destination
move.w d0,$58(a5)
bsr rot.wblit ;work > view
rotpolfil.bx
sub.l #rot_wid,a2
dbra d1,rotpolfil.a
move.w #0,$074(a5) ;a dat
move.l #0,$044(a5) ;mask
move.w #$100+$f0,$040(a5) ;bltcon0
move.w d7,$66(a5) ;bltdmod
move.l a3,$054(a5) ;destination
move.w d0,$58(a5)
bsr rot.wblit ;clr work
movem.l (sp)+,d0-d7/a0-a6
rts
rotpolgls ;d4/d5/a3/a4
movem.l d0-d7/a0-a6,-(sp)
lea rotpln1,a2
move.l a2,a1
add.l #rotplnw-rotpln1,a1 ;workplane
add.l real-rot(a6),a2 ;get scherm 2
move.w #rot_wid,d7 ;wordt modulo
sub.w #16,d4 ;ruimte voor min x
add.w #16,a3 ;ruimte voor max x
; sub.w #2,d5 ;ruimte voor min y
add.w #1,a4 ;ruimte voor max y
move.w a4,d0 ;maximale y
sub.w d5,d0 ;-minimale y
move.w d0,d2 ;y hoogte (in lijnen)
lsl.w #6,d0 ;*64
move.w a3,d1 ;maximale x
sub.w d4,d1 ;-minimale x
lsr.w #4,d1 ;/16
move.w d1,d3 ;x breedte (in words)
add.w d1,d0 ;bltsize
muls #rot_wid,d5 ;minimale y
add.l d5,a1 ;+workplane
lsr.l #1,d5 ;/2 (voor hi-res)
muls #rot_dpt,d5 ;minimale y
lsl.l #1,d5 ;*2
add.l d5,a2 ;+destination scherm
lsr.w #4,d4 ;/16 minimale x
lsl.w #1,d4 ;*2 minimale x
add.l d4,a1 ;+workplane
add.l d4,a2 ;+destination scherm
muls #rot_wid,d2 ;y hoogte
lsl.w #1,d3 ;*2 x breedte
sub.w d3,d7 ;module aftrekken
add.l d3,d2
move.l a1,a3 ;workscherm bewaren
add.l d2,a1 ;reverse fill add
move.l a1,$4c(a5) ;bltbpt
move.l a1,$54(a5) ;bltdpt
move.w d7,$62(a5) ;bltbmod
move.w d7,$66(a5) ;bltdmod
move #%0000010111001100,$40(a5) ;bltcon0
move #%0000000000010010,$42(a5) ;bltcon1
move d0,$58(a5) ;bltsiz
bsr rot.wblit ;wait for blit
add.l #2,a3 ;reverse ?
add.l #2,a2 ;reverse ?
move.w #$f00+$ca,$040(a5) ;bltcon0
move.w #0,$042(a5) ;bltcon1
move.l #-1,$044(a5) ;mask
move.w d7,d6
add.w #rot_wid*(rot_dpt-1),d6
move.w d6,$60(a5) ;bltcmod
move.w d7,$62(a5) ;bltbmod
move.w d7,$64(a5) ;bltamod
move.w d6,$66(a5) ;bltdmod
move.w a0,d6 ;kleur halen
move.l a3,a4 ;empty positie
add.l #rotplne-rotplnw,a4
add.l #rot_wid*(rot_dpt-1),a2
move.w #rot_dpt-1,d1
rotpolgls.a
move.l a3,d2
btst d1,d6 ;kleurnbit test
beq.s rotpolgls.bx ;doorschijnend
; bne rotpolgls.c
; move.l a4,d2 ;solid
;rotpolgls.c
move.l a2,$48(a5) ;bltcpt destination
move.l d2,$4c(a5) ;bltbpt picture
move.l a3,$50(a5) ;bltapt mask
move.l a2,$54(a5) ;bltdpt destination
move.w d0,$58(a5)
bsr rot.wblit ;work > view
rotpolgls.bx
sub.l #rot_wid,a2
dbra d1,rotpolgls.a
move.w #0,$074(a5) ;a dat
move.l #0,$044(a5) ;mask
move.w #$100+$f0,$040(a5) ;bltcon0
move.w d7,$66(a5) ;bltdmod
move.l a3,$054(a5) ;destination
move.w d0,$58(a5)
bsr rot.wblit ;clr work
movem.l (sp)+,d0-d7/a0-a6
rts
line
movem.l d0-d7/a0-a6,-(sp)
lea mt,a0 ;scherm breedte tabel
cmp.w d1,d3 ;y1=y2 ?
beq line.end
bgt.s nohi
exg d0,d2
exg d1,d3
nohi
move d0,d4
move d1,d5
add d5,d5
add d5,d5 ;*4
move.l a6,a1
add.l #rotplnw-rot,a1
add.l (a0,d5.w),a1 ;y raw
lsr #4,d4 ;*16
add d4,d4 ;*2
lea (a1,d4.w),a1 ;x raw
sub.w d0,d2
sub.w d1,d3
moveq #15,d5
and.l d5,d0
move.w d0,d4
ror.l #4,d0
eor.w d5,d4
moveq #0,d5
bset d4,d5
move.w #4,d0
tst.w d2
bpl.s l1
addq.w #1,d0
neg.w d2
l1 cmp.w d2,d3
ble.s l2
exg d2,d3
subq.w #4,d0
add.w d0,d0
l2 move.w d3,d4
sub.w d2,d4
add.w d4,d4
add.w d4,d4
add.w d3,d3
moveq #0,d6
move.w d3,d6
sub.w d2,d6
bpl.s l3
or.w #16,d0
l3 add.w d3,d3
add.w d0,d0
add.w d0,d0
addq.w #1,d2
lsl.w #6,d2
addq.w #2,d2
swap d3
move.w d4,d3
or.l #$0b5a0003,d0
move.w #-1,$72(a5)
move.l #-1,$44(a5)
move.w #rot_wid,$60(a5)
move.w #rot_wid,$66(a5)
move.w #$8000,$74(a5)
eor.w d5,(a1) ;inverteert onderste punt lijn
move.l d3,$62(a5) ;bltmod b+a
move.w d6,$52(a5) ;bltapth
move.l a1,$48(a5) ;bltcpt
move.l a1,$54(a5) ;bltdpt
move.l d0,$40(a5) ;bltcon 0+1
move d2,$58(a5) ;bltsiz
bsr rot.wblit ;wait for blit
line.end
movem.l (sp)+,d0-d7/a0-a6
rts
line_init1 ;scherm breedte tabel
movem.l d0-d7/a0-a6,-(sp)
lea mt,a0 ;vullen
tst.l 4(a0) ;al gevuld ?
bne.s line_init1.end
moveq #0,d1
move #rot_hgt-1,d0
line_init1.a ;scherm breedte tabel
move.l d1,(a0)+
add.l #rot_wid,d1
dbf d0,line_init1.a
line_init1.end
movem.l (sp)+,d0-d7/a0-a6
rts
;DRAWLINE-ROUTINE
;d0 = x1
;d1 = y1
;d2 = x2
;d3 = y2
;uses d0-d6
DRAWLINE:
movem.l d0-d7/a0-a6,-(sp)
ifnd nodraw
move.l #rot_wid*rot_dpt,d4
mulu d1,d4
moveq #-$10,d5
and.w d0,d5
lsr.w #3,d5
add.w d5,d4
lea rotpln1,a0
add.l real-rot(a6),a0 ;get scherm 2
add.l a0,d4 ;raw rotplanes
moveq.l #0,d5
sub.w d1,d3
roxl.b #1,d5
tst.w d3
bge.s Y2GY1
neg.w d3
Y2GY1: sub.w d0,d2
roxl.b #1,d5
tst.w d2
bge.s X2GX1
neg.w d2
X2GX1: move.w d3,d1 ;d3=deltay d1=d3
sub.w d2,d1 ;d2=deltax d1=deltay
bge.s DYGDX
exg d2,d3
DYGDX: roxl.b #1,d5
move.b octtabel(pc,d5),d5
add.w d2,d2 ;2*Gdelta
move.w d2,$0062(a5) ;d2 2*Gdelta
sub.w d3,d2 ;2*Gdelta-Kdelta
bge.s SIGNNL ;Negative then...
or.b #$40,d5 ;Set bit 6(=64) van octtant waarde
SIGNNL: move.w d2,$0052(a5) ;2*Gdelta-Kdelta in BLTAPTL
sub.w d3,d2 ;2*Gdelta-2*Kdelta
move.w d2,$0064(a5) ;in BLTAMOD
move.w #$8000,$0074(a5)
move.w #$ffff,$0072(a5)
move.l #$ffffffff,$0044(a5)
and.w #$000f,d0
ror.w #4,d0
or.w #$0bca,d0
move.w d0,$0040(a5)
move.w d5,$0042(a5)
move.l d4,$0048(a5)
move.l d4,$0054(a5)
move.w #rot_wid*rot_dpt,$0060(a5)
move.w #rot_wid*rot_dpt,$0066(a5)
addq.w #1,d3
lsl.w #6,d3
addq.w #2,d3
move.w d3,$0058(a5)
bsr rot.wblit
endc
movem.l (sp)+,d0-d7/a0-a6
rts
octtabel:
dc.b 0*4+1
dc.b 4*4+1
dc.b 2*4+1
dc.b 5*4+1
dc.b 1*4+1
dc.b 6*4+1
dc.b 3*4+1
dc.b 7*4+1
ifd mx68882 ;68882 routines by Roger Heykoop !
VECTOR: ;coordinaten bereken
; 6666 8888 8888 8888 2222
; 6 8 8 8 8 8 8 2
; 6 8 8 8 8 8 8 2
; 66666 8888 8888 8888 2222 optimized code
; 6 6 8 8 8 8 8 8 2
; 6 6 8 8 8 8 8 8 2
; 6666 8888 8888 8888 2222
movem.l d0-d7/a0-a6,-(sp)
LEA xy,A1 ;resultaten
move.l curvec-rot(a6),a0
add.l #vec_xyz,a0 ;info overslaan
ifd copperspeed
move.w #$f00,$dff180
endc
Vec_jmp:
Fmove.w XROT-rot(a6),Fp6 ;x rotatie in Fp0
Fmove.w YROT-rot(a6),Fp7 ;y rotatie in Fp1
Fmove.w ZROT-rot(a6),Fp2 ;z rotatie in Fp2
Fdiv.x #5.729577951E1,Fp6 ;deelt rotatie door 360/2pi
Fdiv.x #5.729577951E1,Fp7 ;en dus wordt het resultaat
Fdiv.x #5.729577951E1,Fp2 ;tussen on en 2pi !!!
Fsin.x Fp2,Fp4
Fcos.x Fp2,Fp5
Fsin.x Fp6,Fp0
Fcos.x Fp6,Fp1
Fsin.x Fp7,Fp2
Fcos.x Fp7,Fp3
MOVE.W (a0)+,D7 ;aantal punten
VECS:
;Fp0/Fp1/Fp2 zijn de rotatie angles ax ay en az van 0 tot 2pi
;Het resultaat na roteren x' y' en z' is:
; X'= X( cosay * cosaz) - Y( cosay * sinaz) + Z(sinax)
; Y'= X( sinax * sinay * cosaz) + Y(-sinax * sinay * sinaz) + Y(cosax * cosaz) - Z(sinax * sinay)
; Z'= X(-cosax * sinay * cosaz) + X( sinax * sinaz) + Y(cosax * sinay * sinaz) + Y(sinax * cosaz) + Z(cosax*cosay)
;
;Vervang vervolgens: sin ax Fp0
; cos ax Fp1
; sin ay Fp2
; cos ay Fp3
; sin az Fp4
; cos az Fp5
;
; X'= X( Fp3*Fp5) - Y( Fp3*Fp4) + Z(Fp0)
; Y'= X( Fp0*Fp2*Fp5) + Y(-Fp0*Fp2*Fp4) + Y(Fp1*Fp5) - Z(Fp0*Fp2)
; Z'= X(-Fp1*Fp2*Fp5) + X( Fp0*Fp4) + Y( Fp1*Fp2*Fp4) + Y(Fp0*Fp5) + Z(Fp1*Fp3)
;
; X'= X*Fp3*Fp5 - Y*Fp3*Fp4 + Z*Fp0
; Y'= X*Fp0*Fp2*Fp5 + Y*-Fp0*Fp2*Fp4 + Y*Fp1*Fp5 - Z*Fp0*Fp2
; Z'= X*-Fp1*Fp2*Fp5 + X*Fp0*Fp4 + Y*Fp1*Fp2*Fp4 + Y*Fp0*Fp5 + Z*Fp1*Fp3
movem.w (a0)+,d4/d5/d6 ;Haal x,y en z uit geheugen...
;1 memory access,spaart bergen tijd...
;input: d4/d5/d6 x,y,z
Fmove.w d4,Fp6 ;haal x
Fmove.x Fp6,Fp7
Fmul.x Fp3,Fp7
Fmul.x Fp5,Fp7
Fmove.l Fp7,d1 ;x' deel 1...
Fmove.x Fp6,Fp7
Fmul.x Fp0,Fp7
Fmul.x Fp2,Fp7
Fmul.x Fp5,Fp7
Fmove.l Fp7,d2 ;y' deel 1...
Fmove.x Fp6,Fp7
Fmul.x Fp1,Fp7
Fmul.x Fp2,Fp7
Fmul.x Fp5,Fp7
Fmove.l Fp7,d0
move.l d0,d3
neg.l d3 ;z' deel 1a...
Fmove.x Fp6,Fp7
Fmul.x Fp0,Fp7
Fmul.x Fp4,Fp7
Fmove.l Fp7,d0
add.l d0,d3 ;z' deel 1b...
Fmove.w d5,Fp6 ;haal y
Fmove.x Fp6,Fp7
Fmul.x Fp3,Fp7
Fmul.x Fp4,Fp7
Fmove.l Fp7,d0
sub.l d0,d1 ;x' deel 2...
Fmove.x Fp6,Fp7
Fmul.x Fp0,Fp7
Fmul.x Fp2,Fp7
Fmul.x Fp4,Fp7
Fmove.l Fp7,d0
sub.l d0,d2 ;y' deel 2a...
Fmove.x Fp6,Fp7
Fmul.x Fp1,Fp7
Fmul.x Fp5,Fp7
Fmove.l Fp7,d0
add.l d0,d2 ;y' deel 2b...
Fmove.x Fp6,Fp7
Fmul.x Fp1,Fp7
Fmul.x Fp2,Fp7
Fmul.x Fp4,Fp7
Fmove.l Fp7,d0
add.l d0,d3 ;z' deel 2a...
Fmove.x Fp6,Fp7
Fmul.x Fp0,Fp7
Fmul.x Fp5,Fp7
Fmove.l Fp7,d0
add.l d0,d3 ;z' deel 2b...
Fmove.w d6,Fp6 ;haal z
Fmove.x Fp6,Fp7
Fmul.x Fp0,Fp7
Fmove.l Fp7,d0
add.l d0,d1 ;x' deel 3...
Fmove.x Fp6,Fp7
Fmul.x Fp0,Fp7
Fmul.x Fp3,Fp7
Fmove.l Fp7,d0
sub.l d0,d2 ;y' deel 3...
Fmove.x Fp6,Fp7
Fmul.x Fp1,Fp7
Fmul.x Fp3,Fp7
Fmove.l Fp7,d0
add.l d0,d3 ;z' deel 3...
;nu: d1/d2/d3 bevat x'y'z'...
move.w d3,d4
add.w ZV-rot(a6),d4 ;z ball
sub.w ZV-rot(a6),D3 ;z centrum
move.w drot-rot(a6),d0 ;grote wereld
muls d0,D1 ;muls !
divs D3,D1 ;divs !
add.W XV-rot(a6),D1 ;x centrum
muls d0,D2 ;muls !
divs D3,D2 ;divs !
add.w YV-rot(a6),D2 ;y centrum
muls d0,D4 ;muls ! z ball
ifeq rot_hgt-384
lsr.l #8,d4 ;/256
lsr.l #3,d4 ;/2
move.w d4,d3
lsr.w #1,d4 ;/2
add.w d3,d4
endc
ifeq rot_hgt-(384*2) ;/6144
lsr.l #8,d4 ;/256
lsr.l #4,d4 ;/4
move.w d4,d3
lsr.w #1,d4 ;/2
add.w d3,d4
endc
movem.w d1/d2/d4,(a1)
add.l #3*2,a1
; lea 2(a0),a0
add.l #2,a0 ;kleur
Dbra D7,VECS ;Ah! A loop...Are the caches
;on mr. Zulu? Warp factor 9,sir!
ifd copperspeed
move.w #$000,$dff180
endc
movem.l (sp)+,d0-d7/a0-a6
RTS
endc
ifnd mx68882
VECTOR: ;coordinaten bereken
movem.l d0-d7/a0-a6,-(sp)
LEA xy,A1
LEA SINCOS+$5a,A2
ifd copperspeed
move.w #$f00,$dff180
endc
move.l curvec-rot(a6),a0
add.l #vec_xyz,a0 ;info overslaan
MOVE.W (a0)+,D7 ;aantal punten
VECS:
MOVE.W (A0)+,D0 ;x
MOVE.W D0,D2 ;
MOVE.W (A0)+,D1 ;y
MOVE.W D1,D3 ;
MOVE.W ZROT-rot(a6),D6 ;
MOVE.W $5a(A2,D6.W),D4 ;
MOVE.W -$5a(A2,D6.W),D5 ;
MULS.W D4,D0 ;
MULS.W D5,D1 ;
SUB.L D1,D0 ;
ADD.L D0,D0 ;
SWAP D0 ;
MULS.W D5,D2 ;muls !
MULS.W D4,D3 ;muls !
ADD.L D3,D2 ;
ADD.L D2,D2
SWAP D2 ;
MOVE.W D2,D4 ;
MOVE.W (A0)+,D1 ;z
MOVE.W D1,D3 ;
MOVE.W XROT-rot(a6),D6 ;x-rot
MOVE.W $5a(A2,D6.W),D5 ;
MOVE.W -$5a(A2,D6.W),D6 ;
MULS.W D5,D2 ;muls !
MULS.W D6,D1 ;muls !
SUB.L D1,D2 ;
ADD.L D2,D2
SWAP D2 ;
MULS.W D5,D3 ;muls !
MULS.W D6,D4 ;muls !
ADD.L D4,D3 ;
ADD.L D3,D3
SWAP D3 ;
MOVE.W D0,D1 ;
MOVE.W D3,D4 ;
MOVE.W YROT-rot(a6),D6 ;y-rot
MOVE.W $5a(A2,D6.W),D5 ;
MOVE.W -$5a(A2,D6.W),D6 ;
MULS.W D5,D3 ;
MULS.W D6,D0 ;
SUB.L D0,D3 ;
ADD.L D3,D3
SWAP D3 ;
MULS.W D6,D4 ;muls !
MULS.W D5,D1 ;muls !
ADD.L D4,D1 ;
ADD.L D1,D1
SWAP D1 ;d1=x d2=y d3=z na rotatie
move.w d3,d4
add.W ZV-rot(a6),d4 ;z ball
SUB.W ZV-rot(a6),D3 ;z centrum
move.w DROT-rot(a6),d0 ;grote wereld
MULS d0,D1 ;muls !
DIVS D3,D1 ;divs !
ADD.W XV-rot(a6),D1 ;x centrum
MULS d0,D2 ;muls !
DIVS D3,D2 ;divs !
ADD.W YV-rot(a6),D2 ;y centrum
MOVE.W D1,(A1)+ ;x
MOVE.W D2,(A1)+ ;y
MULS d0,D4 ;muls ! z ball
; divs #rot_hgt*20,d4 ;divs !
ifeq rot_hgt-384
lsr.l #8,d4 ;/256
lsr.l #3,d4 ;/2
move.w d4,d3
lsr.w #1,d4 ;/2
add.w d3,d4
endc
ifeq rot_hgt-(384*2) ;/6144
lsr.l #8,d4 ;/256
lsr.l #4,d4 ;/4
move.w d4,d3
lsr.w #1,d4 ;/2
add.w d3,d4
endc
MOVE.W d4,(A1)+ ;z
lea 2(a0),a0
; add.l #2,a0 ;kleur
Dbra D7,VECS
ifd copperspeed
move.w #$000,$dff180
endc
movem.l (sp)+,d0-d7/a0-a6
RTS
endc
;rot.baldat ds.l 64*3*4
curvec dc.l 0
rotpal dc.l 0
real: dc.l 0
XROT: dc.w 0 ;aantal graden te roteren om X-as
YROT: dc.w 0 ;aantal graden om Y-as
ZROT: dc.w 0 ;aantal om Z-as
DROT: dc.w 0
XV: dc.w (rot_wid+rot_cen)*4; ;centrum xcoord
YV: dc.w (rot_hgt/2) ;ycoord
ZV: dc.w 780 ;zcoord
xadd dc.w 0
yadd dc.w 0
zadd dc.w 0
dadd dc.w 0
dway dc.w 0
bufmod dc.b 0
clrmod dc.b 0
cnop 0,2
ifnd mx68882
SINCOS:
dc.w 0,571,1143,1714,2285,2855,3425,3993
dc.w 4560,5125,5689,6252,6812,7370,7927,8480
dc.w 9031,9580,10125,10667,11206,11742,12274,12803
dc.w 13327,13847,14364,14875,15383,15885,16383,16876
dc.w 17363,17846,18323,18794,19259,19719,20173,20620
dc.w 21062,21497,21925,22347,22761,23169,23570,23964
dc.w 24350,24729,25100,25464,25820,26168,26509,26841
dc.w 27165,27480,27788,28086,28377,28658,28931,29195
dc.w 29450,29696,29934,30162,30381,30590,30790,30981
dc.w 31163,31335,31497,31650,31793,31927,32050,32164
dc.w 32269,32363,32448,32522,32587,32642,32687,32722
dc.w 32747,32762,32767,32762,32747,32722,32687,32642
dc.w 32587,32522,32448,32363,32269,32164,32050,31927
dc.w 31793,31650,31497,31335,31163,30981,30790,30590
dc.w 30381,30162,29934,29696,29450,29195,28931,28658
dc.w 28377,28086,27787,27480,27165,26841,26509,26168
dc.w 25820,25464,25100,24729,24350,23964,23570,23169
dc.w 22761,22347,21925,21497,21062,20620,20173,19719
dc.w 19259,18794,18323,17846,17363,16876,16383,15885
dc.w 15383,14875,14364,13848,13327,12803,12274,11742
dc.w 11207,10667,10125,9580,9031,8480,7927,7371
dc.w 6812,6252,5690,5126,4560,3993,3425,2855
dc.w 2285,1715,1143,572,0
dc.w -571,-1143,-1714
dc.w -2285,-2855,-3424,-3993,-4560,-5125,-5689,-6252
dc.w -6812,-7370,-7926,-8480,-9031,-9579,-10125,-10667
dc.w -11206,-11742,-12274,-12802,-13327,-13847,-14363,-14875
dc.w -15382,-15885,-16383,-16876,-17363,-17845,-18322,-18794
dc.w -19259,-19719,-20173,-20620,-21062,-21496,-21925,-22346
dc.w -22761,-23169,-23570,-23964,-24350,-24729,-25100,-25464
dc.w -25820,-26168,-26508,-26840,-27164,-27480,-27787,-28086
dc.w -28376,-28658,-28931,-29195,-29450,-29696,-29933,-30162
dc.w -30380,-30590,-30790,-30981,-31163,-31335,-31497,-31650
dc.w -31793,-31927,-32050,-32164,-32269,-32363,-32448,-32522
dc.w -32587,-32642,-32687,-32722,-32747,-32762,-32767,-32762
dc.w -32747,-32722,-32687,-32642,-32587,-32522,-32448,-32363
dc.w -32269,-32165,-32051,-31927,-31793,-31650,-31497,-31335
dc.w -31163,-30981,-30791,-30590,-30381,-30162,-29934,-29697
dc.w -29451,-29195,-28931,-28658,-28377,-28087,-27788,-27481
dc.w -27165,-26841,-26509,-26169,-25821,-25465,-25101,-24729
dc.w -24351,-23964,-23571,-23170,-22762,-22347,-21925,-21497
dc.w -21062,-20621,-20173,-19720,-19260,-18794,-18323,-17846
dc.w -17364,-16876,-16384,-15886,-15383,-14876,-14364,-13848
dc.w -13328,-12803,-12275,-11743,-11207,-10668,-10126,-9580
dc.w -9032,-8481,-7927,-7371,-6813,-6252,-5690,-5126
dc.w -4560,-3994,-3425,-2856,-2286,-1715,-1144,-572
dc.w 0,571,1142,1714,2284,2855,3424,3992
dc.w 4559,5125,5689,6251,6811,7370,7926,8479
dc.w 9031,9579,10124,10667,11206,11741,12273,12802
dc.w 13326,13847,14363,14875,15382,15885,16382,16875
dc.w 17363,17845,18322,18793,19259,19718,20172,20620
dc.w 21061,21496,21924,22346,22761,23169,23569,23963
dc.w 24350,24728,25100,25464,25820,26168,26508,26840
dc.w 27164,27480,27787,28086,28376,28658,28931,29195
dc.w 29450,29696,29933,30161,30380,30590,30790,30981
dc.w 31162,31334,31497,31650,31793,31926,32050,32164
dc.w 32269,32363,32447,32522,32587,32642,32687,32722
dc.w 32747,32761,32767
endc
rotbaltab ds.l 64
xy ds.l 2*1024 ;x/y/z coordinaten
rotdontab ds.l 2*1024 ;is getekend tabel
mt ds.l rot_hgt ;mulutable (faster)
;pic_wid equ 4 ;wide in bytes
;pic_hgt equ 6 ;hoogte
;pic_dpt equ 8 ;number planes
;pic_ani equ 10 ;aantal effes (anim)
;pic_vew equ 12 ;viewmode
;pic_cycstr equ 14 ;cycle start (*4)
;pic_cycend equ 15 ;cycle end (*4)
;pic_cycspd equ 16 ;cycle speed (*4)
;pic_cycadd equ 17 ;cycle add (*4)
;pic_palnum equ 30 ;aantal kleuren
;pic_pal equ 32 ;palette start
;pic_palsiz equ 256*2 ;vaste palette size
;pic_raw equ pic_pal+pic_palsiz ;palette start
;copperlijst in geval van vectorshade
ifd shade
rotcop
dc.w $0080,$0000,$0082,$0000 ;vt-copper terugspring-adres
dc.w $00e4,$0000,$00e6,$0000
dc.w $00e8,$0000,$00ea,$0000
dc.w $00ec,$0000,$00ee,$0000
dc.w $00f0,$0000,$00f2,$0000
dc.w $0100,$5000
dc.w $0108,rot_wid-vew_wid
dc.w $010a,rot_wid-vew_wid
dc.w $0088,$0000 ;terug naar vt-copper
dc.w $ffff,$fffe
endc
;dit zijn de picture-tabellen, 2 voor double buffer
;of 6 voor vectorshade
rotpic1
dc.l 'PICT'
dc.w rot_wid,rot_hgt,rot_dpt,1,rot_vew
dc.b 0,0,0,0
dc.b 0,0,0,0
dc.b 0,0,0,0
dc.b 0,0,0,0
ifeq 1-rot_dpt
ifnd shade
dc.w 2-1
rotpal1
dc.w $000,$fff
ds.w 256-2
endc
ifd shade
dc.w 32-1
rotpal1
dc.w $000,$fff,$ccc,$fff,$999,$fff,$ccc,$fff
dc.w $666,$fff,$ccc,$fff,$999,$fff,$ccc,$fff
dc.w $333,$fff,$ccc,$fff,$999,$fff,$ccc,$fff
dc.w $666,$fff,$ccc,$fff,$999,$fff,$ccc,$fff
ds.w 256-32
endc
endc
ifeq 2-rot_dpt
dc.w 4-1
rotpal1
dc.w $000,$f0f,$0ff,$fff
; dc.w $000,$555,$aaa,$fff
ds.w 256-4
endc
ifeq 3-rot_dpt
dc.w 8-1
rotpal1
dc.w $000,$f00,$0f0,$ff0,$00f,$f0f,$0ff,$fff
; dc.w $000,$333,$555,$777,$999,$bbb,$ddd,$fff
ds.w 256-8
endc
ifeq 4-rot_dpt
dc.w 16-1
rotpal1
dc.w $000,$f00,$0f0,$ff0,$00f,$f0f,$0ff,$fff
dc.w $555,$f55,$5f5,$ff5,$55f,$f5f,$5ff,$fff
; dc.w $000,$111,$222,$333,$444,$555,$666,$777
; dc.w $888,$999,$aaa,$bbb,$ccc,$ddd,$eee,$fff
ds.w 256-16
endc
ifeq 5-rot_dpt
dc.w 32-1
rotpal1
dc.w $000,$111,$222,$333,$444,$555,$666,$777
dc.w $888,$999,$aaa,$bbb,$ccc,$ddd,$eee,$fff
dc.w $00,$11,$22,$33,$44,$55,$66,$77
dc.w $88,$99,$aa,$bb,$cc,$dd,$ee,$ff
ds.w 256-32
endc
ifeq 6-rot_dpt
dc.w 32-1
rotpal1
dc.w $000,$111,$222,$333,$444,$555,$666,$777
dc.w $888,$999,$aaa,$bbb,$ccc,$ddd,$eee,$fff
dc.w $00,$11,$22,$33,$44,$55,$66,$77
dc.w $88,$99,$aa,$bb,$cc,$dd,$ee,$ff
ds.w 256-32
endc
rotpln1
ds.b rot_wid*rot_hgt*rot_dpt
rotpic2
dc.l 'PICT'
dc.w rot_wid,rot_hgt,rot_dpt,1,rot_vew
dc.b 0,0,0,0
dc.b 0,0,0,0
dc.b 0,0,0,0
dc.b 0,0,0,0
ifeq 1-rot_dpt
ifnd shade
dc.w 2-1
rotpal2
dc.w $000,$fff
ds.w 256-2
endc
ifd shade
dc.w 32-1
rotpal2
dc.w $000,$fff,$ccc,$fff,$999,$fff,$ccc,$fff
dc.w $666,$fff,$ccc,$fff,$999,$fff,$ccc,$fff
dc.w $333,$fff,$ccc,$fff,$999,$fff,$ccc,$fff
dc.w $666,$fff,$ccc,$fff,$999,$fff,$ccc,$fff
ds.w 256-32
endc
endc
ifeq 2-rot_dpt
dc.w 4-1
rotpal2
dc.w $000,$f0f,$0ff,$fff
; dc.w $000,$555,$aaa,$fff
ds.w 256-4
endc
ifeq 3-rot_dpt
dc.w 8-1
rotpal2
dc.w $000,$f00,$0f0,$ff0,$00f,$f0f,$0ff,$fff
; dc.w $000,$333,$555,$777,$999,$bbb,$ddd,$fff
ds.w 256-8
endc
ifeq 4-rot_dpt
dc.w 16-1
rotpal2
dc.w $000,$f00,$0f0,$ff0,$00f,$f0f,$0ff,$fff
dc.w $555,$f55,$5f5,$ff5,$55f,$f5f,$5ff,$fff
; dc.w $000,$111,$222,$333,$444,$555,$666,$777
; dc.w $888,$999,$aaa,$bbb,$ccc,$ddd,$eee,$fff
ds.w 256-16
endc
ifeq 5-rot_dpt
dc.w 32-1
rotpal2
dc.w $000,$111,$222,$333,$444,$555,$666,$777
dc.w $888,$999,$aaa,$bbb,$ccc,$ddd,$eee,$fff
dc.w $00,$11,$22,$33,$44,$55,$66,$77
dc.w $88,$99,$aa,$bb,$cc,$dd,$ee,$ff
ds.w 256-32
endc
ifeq 6-rot_dpt
dc.w 32-1
rotpal2
dc.w $000,$111,$222,$333,$444,$555,$666,$777
dc.w $888,$999,$aaa,$bbb,$ccc,$ddd,$eee,$fff
dc.w $00,$11,$22,$33,$44,$55,$66,$77
dc.w $88,$99,$aa,$bb,$cc,$dd,$ee,$ff
ds.w 256-32
endc
rotpln2
ds.b rot_wid*rot_hgt*rot_dpt
ifd shade
dc.l 'PICT'
dc.w rot_wid,rot_hgt,rot_dpt,1,rot_vew
dc.b 0,0,0,0
dc.b 0,0,0,0
dc.b 0,0,0,0
dc.b 0,0,0,0
dc.w 32-1
dc.w $000,$fff,$ccc,$fff,$999,$fff,$ccc,$fff
dc.w $666,$fff,$ccc,$fff,$999,$fff,$ccc,$fff
dc.w $333,$fff,$ccc,$fff,$999,$fff,$ccc,$fff
dc.w $666,$fff,$ccc,$fff,$999,$fff,$ccc,$fff
ds.w 256-32
ds.b rot_wid*rot_hgt*rot_dpt
dc.l 'PICT'
dc.w rot_wid,rot_hgt,rot_dpt,1,rot_vew
dc.b 0,0,0,0
dc.b 0,0,0,0
dc.b 0,0,0,0
dc.b 0,0,0,0
dc.w 32-1
dc.w $000,$fff,$ccc,$fff,$999,$fff,$ccc,$fff
dc.w $666,$fff,$ccc,$fff,$999,$fff,$ccc,$fff
dc.w $333,$fff,$ccc,$fff,$999,$fff,$ccc,$fff
dc.w $666,$fff,$ccc,$fff,$999,$fff,$ccc,$fff
ds.w 256-32
ds.b rot_wid*rot_hgt*rot_dpt
dc.l 'PICT'
dc.w rot_wid,rot_hgt,rot_dpt,1,rot_vew
dc.b 0,0,0,0
dc.b 0,0,0,0
dc.b 0,0,0,0
dc.b 0,0,0,0
dc.w 32-1
dc.w $000,$fff,$ccc,$fff,$999,$fff,$ccc,$fff
dc.w $666,$fff,$ccc,$fff,$999,$fff,$ccc,$fff
dc.w $333,$fff,$ccc,$fff,$999,$fff,$ccc,$fff
dc.w $666,$fff,$ccc,$fff,$999,$fff,$ccc,$fff
ds.w 256-32
ds.b rot_wid*rot_hgt*rot_dpt
dc.l 'PICT'
dc.w rot_wid,rot_hgt,rot_dpt,1,rot_vew
dc.b 0,0,0,0
dc.b 0,0,0,0
dc.b 0,0,0,0
dc.b 0,0,0,0
dc.w 32-1
dc.w $000,$fff,$ccc,$fff,$999,$fff,$ccc,$fff
dc.w $666,$fff,$ccc,$fff,$999,$fff,$ccc,$fff
dc.w $333,$fff,$ccc,$fff,$999,$fff,$ccc,$fff
dc.w $666,$fff,$ccc,$fff,$999,$fff,$ccc,$fff
ds.w 256-32
ds.b rot_wid*rot_hgt*rot_dpt
endc
; Section plane,data_c
rotplnw
ds.b rot_wid*rot_hgt ;work bitplane (filled vectors)
rotplne
ds.b rot_wid*rot_hgt ;empty bitplane (filled vectors)
rot.e
;**********************************************************************
;and here are the incbin-files....
ifd rout
cnop 0,2
; Section Data,Data_f ;32-bits fast-mem !
rottube
incbin 'videotracker:Effect/Tube.vec'
endc